Categories
php

Using a Zend view helper inside a partial

When rendering a page using one or more partials, I often need to call a helper to do some extra stuff for me.

One caveat I found was, that the view variables was not available in my helper.

After some research it seems that the partial acts as the new view.
So in order to access the views variables, you need to pass them to your partial.

<?php echo $this->partial('partial-path/partial', array('variable1', $this->variable1, ...)); ?>

Leave a Reply

Your email address will not be published. Required fields are marked *