doulizhi1247 2014-04-27 18:59
浏览 30
已采纳

Yii - 覆盖$ content

As far as I noticed seeking across the internet, there's no nice&smooth method for template inheritance in Yii, but I'm wondering if there's a nice method to at least overwrite $content in a template. Basically, I'm trying to avoid something like this:

// 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');

How should it get done right?

  • 写回答

1条回答

  • duanbipu7601 2014-04-28 02:35
    关注

    There are many ways to templating. Layouts can be customised to your needs very much. Have a look at Yii definitive guide topic. Also this

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题