【问题标题】:Yii - overwriting $contentYii - 覆盖 $content
【发布时间】:2014-04-27 18:59:36
【问题描述】:

据我注意到在 Internet 上的搜索,Yii 中没有很好的模板继承方法,但我想知道是否有一个很好的方法至少覆盖模板中的 $content。基本上,我试图避免这样的事情:

// Let's say that I have a website with a nice layout and I created a "support" module and in its main theme I want to add a nice heading and some activity status under the $content

// modules/support/templates/main.php

$content = '<div id="someCoolHeader">lorem ipsum</div>'.$content.'<div id="supportAvailability">'.isSuportActive().'</div>';

require_once(CWebApplication::getViewPath().DIRECTORY_SEPARATOR.'main.php');

应该怎么做才对?

【问题讨论】:

    标签: php templates view yii frameworks


    【解决方案1】:

    模板的方法有很多种。布局可以根据您的需要进行定制。看看 Yii 权威指南主题。还有this

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-01-28
      • 1970-01-01
      • 1970-01-01
      • 2013-05-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多