Steps to change meta tags in zend framework layout
It would recommend setting a view variable for the keywords.
For example, in your bootstrap.php you could define default keywords as
follows:
<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
protected function
_initDoctype() {
$this->bootstrap('view');
$view =
$this->getResource('view');
$view->doctype('XHTML1_STRICT');
$viewRenderer
= new Zend_Controller_Action_Helper_ViewRenderer();
$viewRenderer->setView($view);
$view->headTitle('Techinfo Tricks Solutions')->setSeparator(' ::
');
$view->keywords = 'Techinfo Tricks Web Solutions';
}
In layout.phtml we would have then:
<?php echo
$this->headMeta()->appendName('keywords', $this->keywords); ?>
Finally, in your views (or actions) you could change the Meta keywords simply by changing the keywords view
variable:
// in an action
$this->view->keywords = 'new kewords';
//or in a view
<?php $this->keywords = 'new kewords'; ?>
public function aboutusAction()
{
$this->view->keywords = 'About US';
}
No comments:
Post a Comment