venkat
venkat

Reputation: 513

how to refer one .phtml in the other views in Zend

am new in Zend framework.

I have one .phtml file, includes menus section. i need to add that .phtml file in to the views i.e views/scripts/index.phtml page.

how can refer that

please advice

thanks in advance

Upvotes: 3

Views: 2261

Answers (2)

Thermech
Thermech

Reputation: 4451

Try this

echo $this->partial('path/file.phtml', 'ModuleName')

Upvotes: 0

Arnaud Le Blanc
Arnaud Le Blanc

Reputation: 99921

You can use the render helper:

<?=$this->render('menu.phtml')?>

If you want to pass specific variables to the rendered script, use the partial helper:

<?=$this->partial('menu.phtml', array("varname" => "value"))?>

The menu.phtml file must be in the search path, which usually is the path to the current module's scripts directory ( view/scripts ). You can either place the menu.phtml file in this directory, or add a directory to the search path using the addScriptPath() method on the view object.

Upvotes: 2

Related Questions