views:

840

answers:

1

So i'm using the standard Zend Layout for my site. I have a number of custom controllers and views, and the content of these pages is displayed, but the details in the head element of the layout.phtml are not shown. Do i need to manually associate the Zend_Layout with each specific controller?. I expected since the layout is loaded via the bootstrap this should be available for free.

My app.ini file has

# layout
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts"
resources.layout.layout = "layout"
#resources.view[] =

# Views
resources.view.encoding = "UTF-8"
resources.view.basePath = APPLICATION_PATH "/views/"

my layout.phtml

<?php echo $this->doctype() ?>
<html xmlns="http://www.w3.org/1999/xhtml"&gt; 
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
  <?php echo $this->headTitle() ?>
  <?php echo $this->jQuery();?>
</head> 
<!-- application/layouts/scripts/layout.phtml -->
<body>
        <div id="content">
            <?php echo $this->layout()->content ?> 
        </div>
</body>

A: 

I am using the following in my Initializer.

 Zend_Layout::startMvc(array(
     'layoutPath' => $this->_root .  '/application/phpancake/layouts',
     'layout' => 'main'
 ));

_root is the path to the directory where the application folder resides.
phpancake is the module name (yours is probably default).
layouts is the directory under which resides my layout file main.phtml

Itay Moav