Zend Layout Problem [closed]
Trying to learn Zend Framework. I am sure I am doing something real stupid, but
开发者_StackOverflow<?= $this->layout()->content?>
shows content for index but not for others...
I mean /views/scripts/index/inex.phtml is coming fine when mydomain/public is called, but /views/scripts/abc/index.phtml isn't shown when mydomain/public/abc is called.
I am not sure if I am stating things clearly enough. But can anyone help?
You can actually just declare it in your application.ini
file like this
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
Then your layouts/scripts/layout.phtml
file could look like this
<?php echo $this->doctype(); ?>
<html>
<head>
<?php echo $this->headTitle(); ?>
<?php echo $this->headLink(); ?>
<?php echo $this->headScript(); ?>
</head>
<body>
<div class="container">
<div class="logo">
<?php echo $this->render('logo.phtml'); ?>
</div>
<div class="container-inner">
<div id="header" class="">
<?php echo $this->render('header.phtml'); ?>
</div>
<div id="content" class="">
<div id="account">
<?php echo $this->render('account.phtml'); ?>
</div>
<div><?php echo $this->partial('priorityMessages.phtml', array('priorityMessages'=>$this->priorityMessenger())); ?></div>
<?php echo $this->layout()->content; ?>
</div>
<div id="footer" class="span-24 last"><?php echo $this->render('footer.phtml'); ?></div>
</div>
</div>
</body>
</html>
logo.phtml
, header.phtml
, footer.phtml
are all files in layouts/scripts/
Works good for me.
you have something wrong with your server conf.
mydomain/public/abc
must be called as
mydomain/abc
so ZF cant find AbcController
and if the useDefaultControllerAlways
froncontroller option is true - ZF starts defaut, IndexController
精彩评论