Wednesday, April 2, 2014

Yii


how to change cwidget->how to create a theme
how to validate
user roles
how to change the site login

site/index.php and so on is the default
 'components' => array(
        'user' => array(
            // enable cookie-based authentication
            'allowAutoLogin' => true,
            'loginUrl' => array
            (
                '0' => '/admin/login/site/login'
            )
        ),
To change default login page




110 (drop down list)
remember to set this
<?php
$yii='/wwwroot/framework/yii.php';
$config=dirname( FILE ).'/protected/config/main.php';

With this con guration, we can access the DB connection object using Yii::app()->db
at any place in our code. Note that Yii::app() returns the application instance that we
create in the entry script.

LoginForm.php
$duration=$this->rememberMe ? 3600*24*30 : 0; // 30 days
Yii::app()->user->login($this->_identity,$duration);

validation rules set in models rules method

<?php echo CHtml::activeDropDownList($post,'status',Lookup::items('PostStatus')); ?>

Tag::model()->updateFrequency($this-> oldTags, $this->tags);

access controller

$dataProvider=new CActiveDataProvider('Post', array(
'pagination'=>array(
'pageSize'=>Yii::app()->params['postsPerPage'],
),
'criteria'=>$criteria,
));

<?php $this->widget('zii.widgets.CListView', array(
'dataProvider'=>$dataProvider,
'itemView'=>' view',
'template'=>"fitemsgnnfpagerg",
)); ?>


cgridview

<?php $this->widget('CAutoComplete', array(
'model'=>$model,
'attribute'=>'tags',
'url'=>array('suggestTags'),
'multiple'=>true,
'htmlOptions'=>array('size'=>50),
)); ?>

$this->redirect(array('index'));


smartgit
open project
stage
commit
push to


C:\wamp\www\emplify\api\protected\views\layouts\main.php

Yii::app()->params['basetitle']

No comments:

Post a Comment