Yii Framework Forum: How to add "Clock" widget to the blog demo - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

How to add "Clock" widget to the blog demo Rate Topic: -----

#1 User is offline   mocapapa 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 428
  • Joined: 04-January 09
  • Location:Tokyo, JAPAN

Posted 21 February 2009 - 01:40 AM

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/

Attached File(s)

  • Attached File  clock.jpg (16.57K)
    Number of downloads: 84

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users