开发者

Zend Layout Problem [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 11 years ago.

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜