2014-01-16 72 views
0

如何創建Yii框架動態側邊欄:在Yii框架中創建欄

<?php $this->beginContent('//layouts/main'); ?> 
<div id="content"> 
    <?php echo $content; ?> 
</div><!-- content --> 
<?php $this->endContent(); ?> 

樣子:

<?php $this->beginContent('//layouts/main'); ?> 
<div id="content"> 
    <?php echo $content; ?> 
    <div id="sidebar"> 
     <?php echo $sidebar; ?> 
    </div> 
</div><!-- content --> 
<?php $this->endContent(); ?> 
+0

我們用我公司的一個小工具做這件事。因此,在顯示html代碼的echo中創建一個帶有run()方法的小部件。您可以使用$ this-> widget('...')在任何地方顯示您的小部件 – Jacko07

+0

i代碼文件運行小部件在文件夾themes/classic/views/layouts/file.php中。如何渲染類小部件中的file.php? –

+0

在你的配置文件中使用Yii :: setPathOfAlias()來創建一個指向你的widget目錄的別名並使用$ this-> widget('youralias.yourwidgetname'); – Jacko07

回答