jtutaj (4) [Avatar] Offline
#1
Hello,

I'm now on chapter 5, I did errata lines,


in scripts/place/index.phtml file $this.baseUrl is somehow not seenable by script, however headscript loads javascript files perfectly:



<?php <br /> $this->headScript()->appendFile($this->baseUrl().'/js/yahoo.js');

$this->headScript()->appendFile($this->baseUrl().'/js/connection.js');

$this->headScript()->appendFile($this->baseUrl().'/js/review_feedback.js');

?>
- works good, but following code:



<?php echo "SCRIPT: ".$this->baseUrl() ?>

<?php echo $this->escape($this->title);?>

- shows only title (i. e. Alton Towers)



Also Ajax works just fine, as helpful_yes/helpful_total are being updated and js is responding back to website.



I've noticed baseUrl is not accessible, cause spinner.gif was not loading (and it relies on baseUrl in js file)



also in firebug I can see:



<a onclick="new ReviewFeedback(1, 4, ''); return false;" href="#">Yes </a> - last parameter missing, while _reviewFeedback.phtml has:


<a href="#" onclick="new ReviewFeedback(0, <?php echo $id; ?>, '<?php echo $this->baseUrl(); ?>'); return false;">No</a> <br /> <br/> <br /> <br/> <br /> Do you have some ideas why baseUrl is not passed? <br/> <br /> Regards!<br/> <br /> Jakub Tutaj
akrabat (479) [Avatar] Offline
#2
Re: Chapter 5 baseUrl issue (not js)
Can you post the phtml code that generates the firebug line?

Regards,

Rob...
jtutaj (4) [Avatar] Offline
#3
Re: Chapter 5 baseUrl issue (not js)
This is my _reviewFeedback.phtml file:

<?php
$id = $this->id;
$yesCount = $this->helpful_yes;
$totalCount = $this->helpful_total;
?>

<span id="counts-<?php echo $id ?>">
<?php echo $yesCount ?> of <?php echo $totalCount; ?>
</span>
people found this review helpful. Was this review helpful to you?
<span id="yesno-<?php echo $id ?>" >

<a href="#"
onclick="new ReviewFeedback(1, <?php echo $id; ?>, '<?php echo $this->baseUrl(); ?>'); return false;">Yes
</a>
<a href="#"
onclick="new ReviewFeedback(0, <?php echo $id; ?>, '<?php echo $this->baseUrl(); ?>'); return false;">No
</a>
<span id="spinner-<?php echo $id ?>"></span>
</span>
<div id="message-<?php echo $id ?>"></div>

my place/index.phtml file:

<?php
$this->headScript()->appendFile($this->baseUrl().'/js/yahoo.js');
$this->headScript()->appendFile($this->baseUrl().'/js/connection.js');
$this->headScript()->appendFile($this->baseUrl().'/js/review_feedback.js');

?>
<h1>
<?php echo "SCRIPT: ".$this->baseUrl() ?>
<?php echo $this->escape($this->title);?>
</h1>
<div class="location">
<?php echo nl2br($this->escape($this->displayAddress($this->place)));?>
</div>

<h2>Reviews</h2>

<?php if(count($this->reviews)) : ?>

<ul id="reviews">
<?php echo $this->partialLoop('place/_reviewItem.phtml',$this->reviews) ?>
</ul>

<?php endif; ?>
jtutaj (4) [Avatar] Offline
#4
Re: Chapter 5 baseUrl issue (not js)
Hello! Problem solved partially...spinner.gif shows up (it was SELiux blocking only this image - copied from some other place with the same rights). Still don't know why

echoing $this->baseUrl() returns nothing to the view.

Cheers!
Jakub Tutaj