Код: Выделить всё
'params'=>array(
'runtimeWidgets'=>array(
'Share',
'Comments',
'Contact',
'blog.widgets.LastPosts',
),
),
Код: Выделить всё
class Controller extends CController
{
public function behaviors()
{
return array(
'InlineWidgetsBehavior'=>array(
'class'=>'application.components.DInlineWidgetsBehavior',
'location'=>'application.components.widgets',
'widgets'=>Yii::app()->params['runtimeWidgets'],
'startBlock'=> '{{w:',
'endBlock'=> '}}',
),
);
}
}
Код: Выделить всё
$model->text = '
<h2>Lorem ipsum</h2>
<h2>Latest posts</h2>
<p>{{w:LastPosts}}</p>
<h2>Latest 4 posts</h2>
<p>{{w:LastPosts|limit=4}}</p>
<h2>Latest posts (custom template)</h2>
<p>{{w:LastPosts|limit=5;tpl=small}}</p>
<h2>Latest posts with caching</h2>
<p>{{w:LastPosts|limit=5;tpl=small|cache=300}}</p>
<p>Dolor...</p>
';
echo $this->decodeWidgets($model->text);
Код: https://github.com/ElisDN/inline-widgets-behavior
Описание: http://www.elisdn.ru/blog/13/vstraivaem ... nici-v-yii