How to add an analogue clock widget on your skeleton application

1 0
1
Viewed: 15 481 times
Version: Unknown (update)
Category: Tutorials
    Written by: mocapapa mocapapa
    Updated by: mocapapa mocapapa
    Created: Sep 7, 2010
    Updated: 16 years ago

    You are viewing revision #1 of this wiki article.
    This version may not be up to date with the latest version.
    You may want to view the differences to the latest version.

    next (#2) »


    This is a 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 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