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个回答

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

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐