3

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

Charles
  • 50,943
  • 13
  • 104
  • 142
venkat
  • 513
  • 2
  • 10
  • 16

2 Answers2

2

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.

Arnaud Le Blanc
  • 98,321
  • 23
  • 206
  • 194
  • thanks for your reply. =$this->render('menu.phtml')?> throwing error when we deployed in centos. instead of =$this->render('menu.phtml')?> we can use render('menu.phtml'); ?> – venkat Feb 17 '11 at 10:52
0

Try this

echo $this->partial('path/file.phtml', 'ModuleName')
Thermech
  • 4,371
  • 2
  • 39
  • 60