How to add an analogue clock widget on your skeleton application


Followings are the simple steps to put an analogue clock widget on your skeleton application that is just generated by yiic.

1. Get the files under the trunk of the code repository using svn.
$ svn checkout http://yii-analogue-clock-widget.googlecode.com/svn/trunk/ <yii-analogue-clock-widget>
2. Create a skeleton application using yiic.
$ cd <yii-demo-directory>
$ ../framework/yiic webapp <app-name>
3. Copy image files and php files to the skeleton application.
$ cp <yii-analogue-clock-widget>/analogue-clock-*.png <app-name>/images/
$ cp <yii-analogue-clock-widget>/Clock.php <app-name>/protected/components/
$ mkdir <app-name>/protected/components/views
$ cp <yii-analogue-clock-widget>/analogue-clock.php !$
4. Configure the config file (protected/config/main.php), with inserting a following line that indicates the zii search path.
'import'=>array(
          'application.models.*',
          'application.components.*',
          'zii.widgets.*',  <<< this line
),
5. Change the layout from 'cloumn1' to 'column2' in the controller (protected/components/Controller.php).
public $layout='//layouts/column2';
6. Add a widget call in the side bar in the view file (protected/views/layouts/column2.php).
<?php $this->widget('Clock'); ?>
7. You get the clock widget in the side bar of the skeleton application as follows.

screenshot.jpg

1 0
1 follower
Viewed: 11 728 times
Version: 1.1
Category: Tutorials
Tags:
Written by: mocapapa
Last updated by: mocapapa
Created on: Sep 7, 2010
Last updated: 13 years ago
Update Article

Revisions

View all history