Skip to content

Instantly share code, notes, and snippets.

private function actionAction(){
$criteria = new CDbCritera;
$criteria->compare("username", "john");
$criteria->compare("password", "123");
$users = User::model()->findAll($criteria);
}
public function actionContactus() {
$this->layout = false;
$this->render("path/to/the/view");
}
public function actionUpdatecalendar() {
echo "sample text";
}
// controller
public function actionAjaxU() {
echo "Hello";
}
// view
$this->render("you-view-name", array("title"=>$model));
if( Yii::app()->cache->get("Ali") ){
echo Yii::app()->cache->get("Ali");
}else {
Yii::app()->cache->set("Ali", "Ali Raza", 400);
}
'cache' => array(
'class'=>'system.caching.CFileCache',
'cachePath'=> 'path/to/cache/dir'
),
<?php
$this->widget('ext.gcalendar.GCalendar',array(
'model' =>$model, // remove this line
'inputField'=>'date_of_birth',
'daFormat'=>'dd/mm/yyyy',
)
);
?>
public function actionUpdate($id)
{
$model=$this->loadModel($id);
$roomInformationModel = $this->loadRoomInformationModel( $_GET['roomInfoId'] );
if( isset($_POST['GuestReservations']) && isset($_POST['RoomInformation']) )
{
$roomInformationModel->attributes = $_POST['RoomInformation'];
$model->attributes = $_POST['GuestReservations'];
if( $roomInformationModel->save() && $model->save() ) {
public function actionError()
{
if($error=Yii::app()->errorHandler->error)
{
if(Yii::app()->request->isAjaxRequest)
echo $error['message'];
else
$this->render('error', $error);
}
}