Changes
Title
unchanged
Custom Archive in Blog system
Category
unchanged
Tips
Yii version
unchanged
Tags
unchanged
cdbcriteria, archive, blog customization, post, archive in demo blog
Content
changed
[...]
$yeardataarticle = Post::model()->findAll($condition);
foreach ($yeardataarticle as $ya):
$year =$ya->year;
echo '<br />';
echo $year;
$monthcriteria = new CDbCriteria;[...]
$montth = $month->month;
echo '<br />';
foreach($monthsvalue as $key=>$value):
if($key==$montth){?>
<?php
if (!isset(${'printed'.$key.$year})) ${'printed'.$key.$year} = false;
//var_dump('printed'.$key.$year);exit;
if($key==$montth and !${'printed'.$key.$year}){
echo CHtml::link($value,array('//post/archivepost','year'=>$year,'month'=>$montth))
?>;
<?php }?>
<?php
endforeach;
${'printed'.$key.$year}=true;
$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.')';
}
endforeach;
endforeach;
endforeach;
?>
```[...]