Keyword

k2 tools archive sort by year

  • davididoff
  • davididoff's Avatar Topic Author
  • Offline
  • New Member
More
10 years 3 months ago #129398 by davididoff
k2 tools archive sort by year was created by davididoff
Hi,
i'd like to have k2 tools (archive) like this:

2014
2013
2012
2011


then... only when you click on 2014 should be:

2014
..June
..May
..April
..March
..February
..January
2013
2012
2011

At the time I was only able to do this (image 1).

I worked archive.php:

?>
<div id="k2ModuleBox<?php echo $module->id; ?>" class="k2ArchivesBlock<?php if($params->get('moduleclass_sfx')) echo ' '.$params->get('moduleclass_sfx'); ?>">

<?php
foreach ($months as $month) {
$years[$month->y][] = $month;
}
?>
<?php foreach ($years as $year => $months) : ?>
<h4><?php echo $year; ?></h4>
<ul>
<?php foreach ($months as $month): ?>
<li>
<?php if ($params->get('archiveCategory', 0) > 0): ?>
<a href="<?php echo JRoute::_('index.php?option=com_k2&view=itemlist&t ask=date&month='.$month->m.'&year='.$month->y.'&catid='.$params->get('archiveCategory')); ?>">
<?php echo $month->name.' '.$month->y; ?>
<?php if ($params->get('archiveItemsCounter')) echo '('.$month->numOfItems.')'; ?>
</a>
<?php else: ?>
<a href="<?php echo JRoute::_('index.php?option=com_k2&view=itemlist&t ask=date&month='.$month->m.'&year='.$month->y); ?>">
<?php echo $month->name.' '.$month->y; ?>
<?php if ($params->get('archiveItemsCounter')) echo '('.$month->numOfItems.')'; ?>
</a>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
<?php endforeach; ?>
</div>

thanks

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum