I am new @ Zend2.
I have now 2 layouts, both with for example see below.
layout/layout.phtml
layout/custum.phtml
What's the best way to "push" it once?
In the bootstrap?
<meta charset="<?php echo $charset; ?>">
Both awnsers are very usefull, thnx!
My choice is the header.phtml but the other one i am also going to use.
The HeadMeta view helper can be used to render the HTML metatag.
// layout/header.phtml
$this->headMeta()->setCharset($charset);
echo $this->headMeta();
In terms of 'reusing it' you could use the above in a new view script, say header.phtml
and include it in both layouts using the ViewPartial plugin.
// In both layout.phtml files
echo $this->partial('layout/header.phtml', array('charset' => 'UTF-8'));
if i understand the question correctly, u can either use partial
view helper http://framework.zend.com/manual/1.12/en/zend.view.helpers.html#zend.view.helpers.initial.partial or set a value to layout in bootstrap like this :
$this->bootstrap('layout');
$layout = Zend_Layout::getMvcInstance();
$layout->getView()->assign('charset',"<meta charset='{$charset}'>");
and use it in the layout like a normal var : $this->charset