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.



class Links extends Portlet


        public $title='Links';

        protected function renderContent()





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



<li><a href="">Yii</a>

<li><a href="">Yiijan</a>

<li><a href="">PHP code converter</a>


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


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

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

Have fun ;)

[Updated: Feb 22, 2009]

Collection of the enhancements:…gdemo-enhanced/