Displaying 101-110 of 113 results.
Wiki: Yii 1.1: Archive Yearly and Monthly in Blog systemwiki
posted by admin on January 22, 2016
Hi I had made simple archive system for blog system that can handle tbl_post. I had used simple CDbCriteria not more than that. I know there is more and many better way to this but I think this will give some idea to users to generate new idea or customized or modified this version of code.

//in module define

public $year;
public $month;

In controller controller of view you can use this. I had used here view for testing.

$monthsvalue = array('1'=>'January','2'=>'Feburary','3'=>'March','4'=>'April','5'=>'May','6'=>'June','7'=>'July','8'=>'August','9'=>'September','10'=>'October','11'=>'November','12'=>'December');

$condition = new CDbCriteria;
$condition->select='YEAR(t.createddate) as year'; //declare year in post model model
$condition->order ='createddate DESC';

$yeardataarticle = Post::model()->findAll($condition);

foreach ($yeardataarticle as $ya):
$year =$ya->year;
echo '
echo $year;
$monthcriteria = new CDbCriteria;
$monthcriteria->select ='MONTH(t.createddate) as month'; // declare month in post model
$monthcriteria->condition ='YEAR(t.createddate)=:year';
$months = Post::model()->findAll($monthcriteria);
foreach ($months as $month):

$montth = $month->month;
echo '

foreach($monthsvalue as $key=>$value):

if (!isset(${'printed'.$key.$year})) ${'printed'.$key.$year} = false;


if($key==$montth and !${'printed'.$key.$year}){

echo CHtml::link($value,array('//post/archivepost','year'=>$year,'month'=>$montth));

$postcount = new CDbCriteria;
$postcount->addCondition('MONTH(t.createddate)=:month AND YEAR(t.createddate)=:year');
$postcount->params = array(':month'=>$montth,':year'=>$year);
$count = Post::model()->count($postcount);
echo ' ('.$count.')';



Read more
Resolved: Yii jQuery UI date calendar on form
posted by admin on January 22, 2016
I have text field on form

<div class="row">
<?php echo $form->labelEx($model,'date_from'); ?>
echo $form->textField($model, 'date_from', array(
'size' => 10,
'maxlength' => 10,
<?php echo $form->error($model,'date_from'); ?>

I want to change textfield to jQuery UI date.Read more
Resolved: Yii form dropDownList create and update support example with empty first option
posted by admin on January 22, 2016
I have form on yii. It is news form. I want to change news category by select box and in update form have selected option.Read more
Resolved: Yii admin module link url default
posted by admin on January 21, 2016
I create admin module, and try to open link http://localhost/test/admin , and get 404 error, object not found.Read more
Resolved: Yii gii object not found
posted by admin on January 21, 2016
I try to open http://localhost/test/gii , and get error
Error 404
object not foundRead more
Resolved: Yii captcha does not work first time
posted by admin on December 22, 2015
I am trying to create register form where I used captcha. I have enabled ejax validation. But the there is a problem, captcha does not work first time. When I generate new captcha code, that works. My code is:

In model,

public $verifyCode;

public function rules()
return array(
array('verifyCode','captcha','allowEmpty'=>!CCaptcha::checkRequirements(), 'on'=>'registration'),

array('id, first_name,last_name, email, username, password, password_repeat, user_type, keystring, status, logo_url, last_login_time, create_time, update_time, validation', 'safe', 'on'=>'search'),

In controller:

public function actions()
return array(

In view:

<?php if(CCaptcha::checkRequirements()): ?>
<div class="row">
<?php echo $form->labelEx($model,'verifyCode'); ?>
<?php $this->widget('CCaptcha', array('captchaAction'=>'user/captcha')); ?>
<div class="formfieldarea">
<div class="form-text"></div>
<div class="form-field">
<?php echo $form->textField($model,'verifyCode'); ?>
<div class="hint">Please enter the letters as shown.

Letters are not case-sensitive.</div>
<?php echo $form->error($model,'verifyCode'); ?>
<?php endif; ?>

I have searched in google a lot to find the solution. But did not find. Please help someone.:(Read more
Resolved: yii session_regenerate_id(): Session object destruction failed
posted by admin on January 17, 2016
I got an error, when trying to login without checking REMEMBER ME.Read more
Resolved: Yii - How to customize a CGridView CbuttonColumn
posted by admin on December 25, 2015
Customize default buttons? :(Read more
Resolved: Yii 1.1: syntaxhighlighter extension CListView ajax pagination problem
posted by admin on December 25, 2015
CListView ajax pagination Can't find XML Brush etc.
First page working great, but when working ajax pagination, brushes not working, not finding any brushes.

My code:

<?php Yii::app()->syntaxhighlighter->addHighlighter(); ?>
Read more
Resolved: How To Set The "pagevar" Parameter For The Grid View Widget?
posted by admin on December 25, 2015
I have a gridview widget:

$this->widget('zii.widgets.grid.CGridView', array(
'dataProvider' => $model->search(),
'summaryText' => 'صفحه {page} از مجموع {pages} صفحه',
'enableSorting' => false,
'enablePagination' => true,
'ajaxUpdate' => false,

In the pagination links it includes the model name as prefix to pageVar parameter. is there anyway to set the pageVar property of widget so it changes the links from "index.php?r=item/list&Items_page=2" to "index.php?r=item/list&page=2" ?Read more