-> Short version: I would like to show a layout in my view. How can I call it?
-> Long version I would like to have a table-box in some (not all) pages of my web site. This will be like a widget who shows info about users. So, I created a layout (myLayout.phtml) where I call an helper (MyHelper.php) who, by means a model gets all the infos. Here the point, now I would like from a simple view use this layout for show the table-box. How can i call that layout in my view?
:)
P.S. I followed this good forum (http://inchoo.net/tools-frameworks/zend/zend-framework-custom-view-helper/), but they called the "myLayout.phtml" from the main layout and not from a simple view :/
SOLVED
I put "myLayout.phtml" not in "layouts" folder but in "scripts" folder.
./views/helpers/MyHelper.php
class Zend_View_Helper_MyHelper
{
public function myHelper()
{
$mm = new MyModel();
return $mm->myModel();
}
}
./views/scripts/myViews/myHelperView.phtml (ex myLayout.phtml)
<ul>
<?php foreach($this->myHelper() as $item): ?>
<li><?php echo $item ?></li>
<?php endforeach; ?>
</ul>
and in a simple view i call myHelperView
render("myViews/myHelperView.phtml"); ?>For a kind of my files order I would have preferred keep the last script in a layout folder, but i don't know how read it to that position. I hope this way is a good choise...