dqmchw0071 2013-09-03 10:34
浏览 13
已采纳

从ZF2中的特定视图中删除页脚

How can I remove just the footer from a specific view in ZF2. I have tried

 $View->setTerminal(true);
 return $view;

but it makes the links in the top nav bar inactive. Thanks

  • 写回答

1条回答 默认 最新

  • doude5860 2013-09-03 11:08
    关注

    You could change your base layout for that particular action.

    for example, your main layout may be like this example:

    layout.phtml

    <?php echo $this->doctype(); ?>
    <html lang="en">
        <head>
            <?php echo $this->headTitle($this->translate('TITLE'))->setSeparator(' - ')->setAutoEscape(false) ?>
        </head>
        <body>
         ....
              <?php echo $this->partial('footer') ?>
        </body>
     </html>
    

    You can simple make a duplicate layout, but without the footer partial included (or how ever you are including the footer partial/view etc)

    you would then tell your action to use a different base layout:

    Controller.php

    public function testAction()
    {
        /**
         * Now we use the base with no footer
         */
        $this->layout('layout/no-footer-layout');
        // identical to below, a shortcut
        //$this->layout()->setTemplate('layout/no-footer-layout');
    
        return new ViewModel(array(/** etc **/));
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥35 VBA-JSON中文乱码报错
  • ¥50 dac adc的检定规程
  • ¥20 MIT控制器能控制不稳定系统吗
  • ¥15 公司代码X对业务伙伴X无效,处理方法?
  • ¥15 微信内链接跳转到浏览器打开怎么实现
  • ¥15 三角波可以直接加施密特电路整形到矩形波吗实物
  • ¥15 html,php,在使用html请求php文件时发生了错误,无法请求到php文件读取数据库并用javascript进行数据显示,刷新
  • ¥15 touchsocket udp组播
  • ¥20 MAC怎么安装Silverlight 插件?以及安装了怎么启用
  • ¥15 gis系统开发出现命名空间“ESRI.ArcGIS”中不存在类型或命名空间名“Analyst3D”报错