YII webapp customising from ground up


A)) config/main.php

1. name your webapp

‘name’=’my webapp’

2.  enable gii

‘gii’=>array(
‘class’=>’system.gii.GiiModule’,
‘password’=>’password’,
// If removed, Gii defaults to localhost only. Edit carefully to taste.
‘ipFilters’=>array(‘127.0.0.1′,’::1′),
),

),

3. create your database scheme

4.  beautify url

‘urlManager’=>array(
‘urlFormat’=>’path’,
‘rules’=>array(
‘<controller:\w+>/<id:\d+>’=>'<controller>/view’,
‘<controller:\w+>/<action:\w+>/<id:\d+>’=>'<controller>/<action>’,
‘<controller:\w+>/<action:\w+>’=>'<controller>/<action>’,
),
),

5. enable mysql or point to sqldatabase

‘db’=>array(
‘connectionString’ => ‘mysql:host=localhost;dbname=mywebapp’,
’emulatePrepare’ => true,
‘username’ => ‘root’,
‘password’ => ‘password’,
‘charset’ => ‘utf8’,
),

6. set admin email

‘params’=>array(
// this is used in contact page
‘adminEmail’=>’xxxxx@gmail.com’,
),

 

7. show log messages in the webpage

/ uncomment the following to show log messages on web pages
//
array(
‘class’=>’CWebLogRoute’,
),

componenets/UserIdentity.php

7.  change default passwords

public function authenticate()
{
$users=array(
// username => password
‘demo’=>’demo’,
‘admin’=>’admin’,
);

BB) Download mbmenu plugi

views/layouts/main.php

1. change menus

<?php $this->widget(‘application.extensions.mbmenu.MbMenu’,array(
‘items’=>array(
array(‘label’=>’Home’, ‘url’=>array(‘/site/index’)),
array(‘label’=>’Menu 1’, ‘url’=>array(‘/menu1l’),
‘items’=>array(
array(‘label’=>’sub menu 1’, ‘url’=>array(‘/item11’)),
array(‘label’=>’sub menu 2’, ‘url’=>array(‘/item12)),
),
),

2. change footer

<div id=”footer”>
Copyright &copy; <?php echo date(‘Y’); ?> by my company – All Rights Reserved.<br/>
</div><!– footer –>

CC)  YII-booster plugin

config/main.php

Yii::setPathOfAlias(‘booster’, dirname(__FILE__) . DIRECTORY_SEPARATOR . ‘../extensions/yii-booster’);

// preloading ‘log’ component
‘preload’=>array(‘log’,’booster’),

‘components’=>array(

…………………..

‘booster’=> array(
‘class’ =>’booster.components.Booster’,
‘responsiveCss’=>true,
),

………………………….

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s