How to add "Clock" widget to the blog demo

OK, I have found another solution making use of non domestic clock.

Posted Image

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


[php]


<?php





class Clock extends Portlet


{


        public $title='Clock';





        protected function renderContent()


        {


                $this->render('clock');


        }


}


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


<center>


<embed src="http://www.clocklink.com/clocks/0001-gray.swf?TimeZone=JST&Place=&"


  width="140" height="140" wmode="transparent" type="application/x-shockwave-flash">


</center>


> Note. You may want to change the timezone from JST to whatever.

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


[php]


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





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


Terms & Conditions:

I am using the world clock from http://www.clocklink.com/, thus the user should obey the terms and conditions of this site, though it is free of charge.

Have fun ;)


[Updated: Feb 22, 2009]

Collection of the enhancements:

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