How to add "Links" widget to the blog demo

This is not a big widget, but a very simple one.

  • Copy following code and save as blog/protected/components/Links.php.


[php]


<?php





class Links extends Portlet


{


        public $title='Links';





        protected function renderContent()


        {


                $this->render('links');


        }


}


  • Copy following code and save as blog/protected/components/views/links.php, or make some links whatever you like.


[php]


<ul>


<li><a href="http://www.yiiframework.com/">Yii</a>


<li><a href="http://www.yiijan.org/">Yiijan</a>


<li><a href="http://phpspot.net/php/codeconv/">PHP code converter</a>


</ul>


  • Add following line to blog/protected/views/layouts/main.php.


[php]


    <?php $this->widget('Recent Comment'); ?>


+    <?php $this->widget('Links'); ?>


Have fun ;)


[Updated: Feb 22, 2009]

Collection of the enhancements:

http://code.google.c…gdemo-enhanced/