Custom Archive in Blog system

Comparing #1 with #2

Revision #2 was created by nirmalroka nirmalroka on Aug 24, 2012, 9:17:26 AM.

modified due to bugs on previous code

Content

[...]
$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;
?>

```
[...]