Difference between #1 and #2 of
Custom Archive in Blog system

Revision #2 has been created by nirmalroka on Aug 24, 2012, 9:17:26 AM with the memo:

modified due to bugs on previous code
« previous (#1)

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;
?>

```
[...]
1 0
2 followers
Viewed: 10 599 times
Version: 1.1
Category: Tips
Written by: nirmalroka
Last updated by: nirmalroka
Created on: Aug 24, 2012
Last updated: 12 years ago
Update Article

Revisions

View all history