Continued comments on "Easy PHP Websites With The Zend Framework (2011)" by Jason Gilmore.
The partial loop is discussed on page 50 of Ch.3. Try as I might, I couldn't get the code to produce the desired output. Here's what worked for me:
Code within partial view script:
<li>
<a href="/games/<?php echo $this->asin; ?>"><?php echo $this->title; ?></a>
</li>
Code within view script:
<ul id="hottest">
<?= $this->partialLoop('_hottestgames.phtml',
array(
array('asin' => 'B000TG530M', 'title' => 'Call of Duty 4: Modern Warfare'),
array('asin' => 'B000FRU1UM', 'title' => 'Grand Theft Auto IV'),
array('asin' => 'B000FRU0NU', 'title' => 'Halo 3')
)
); ?>
</ul>
Which results in the following page source:
<ul id="hottest">
<li><a href="/games/B000TG530M">Call of Duty 4: Modern Warfare</a></li>
<li><a href="/games/B000FRU1UM">Grand Theft Auto IV</a></li>
<li><a href="/games/B000FRU0NU">Halo 3</a></li>
</ul>
Hope someone finds that useful!
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment