ZendFrameworkQuickstart application is demo guestbook with Zend library files included,
basic folder structure and some sample data for fetching and entering new.
It is already configured for usage and always updated with the latest release of Zend Framework.
The quickest way to setup Zend FrameworkQuickstart app for you is next 2 steps:
1.you need to download ZendFrameworkQuickstart application files
2.and setup virtual host pointing to public folder (e.g. /var/www/zend.quickstart/public/)
I used ZendFrameworkQuickstart application for you so you can easier test the code I provided.
You just need to download and setup latest ZendFrameworkQuickstart and replace default files with files I posted.
Here is the post:
In layout file (our case “layout.phtml” in application/layouts/scripts/)
we just need to call helper $this->partial and correct path to partial file
<div id="categories">
< ?php echo $this->partial('partials/categories.phtml',
array('categories' => $this->data)); ?>
</div>
with correct “keys” and “values” (our case ‘categories’ and $this->data).
Key (‘categories’) will stand for entity which is iterrated in our partial file in foreach loop
(our case “categories.phtml” in application/layouts/scripts/partials)
<ul>
< ?php foreach($this->categories as $item) : ?>
<li class="item">
<a href="<?php echo $this->url(
array(
"cat"=>$item['key'],
"action"=>"index",
"controller"=>"index",
"module"=>"default"
))?>">
< ?php echo $item['value']; ?></a>
</li>
< ?php endforeach; ?>
</ul>
and value ($this->data) must be defined in our controller class file as a view helper ($this->view->data),
I defined it in init() method so it will be set for all actions in IndexController.
public function init()
{
$this->view->data =
array(
array('key' => 'key_1', 'value' => 'category_1'),
array('key' => 'key_2', 'value' => 'category_2'),
array('key' => 'key_3', 'value' => 'category_3'),
array('key' => 'key_4', 'value' => 'category_4'),
);
}
I added demoAction so you can try to set different data set or you can try to play with the code and create some data set from query result.
Enjoy.
Link to code files.


Welcome Vedran and congratulations for your first article.
Good one dude .
Thanks
Cool work. It really helped me a lot. Thanks for sucha nice demonstration of the code.
Great job dude. It helps me out of headaches.
Nice and still I could not understand it. I am a newbie in zend so i did not knew where to place all of this
if you could still give me a hand of help..that will be great, thanks
Thanks, that was so useful
Typo in Vedran’s profile: “Magneto” ==> Magento.
@Niels great catch but I think it’s not a typo, maybe it’s intentional