Keyword

K2 Archives

More
11 years 11 months ago #127629 by ilan
K2 Archives was created by ilan
I am using the K2 tools module with the archive functionality to display archived items and it is working very well. I will like to limit the archived materials displayed to maybe six months etc. but I haven't been able to find that a way to do that yet. As it is now, I am displaying about a years worth of archive.

Thanks for any help on this issue.

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

More
11 years 10 months ago #127630 by Lefteris
Replied by Lefteris on topic Re: K2 Archives
Hi. There is no option for this. You can only create a template override for the module and tweak the PHP code in the output to display 6 months instead of 12 .

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

More
11 years 10 months ago #127631 by ilan
Replied by ilan on topic Re: K2 Archives
Thanks, can you help with instructions on how to do this if possible? Thanks

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

More
11 years 10 months ago #127632 by Lefteris
Replied by Lefteris on topic Re: K2 Archives
First read docs.joomla.org/How_to_override_the_output_from_the_Joomla!_core to learn how you can override modules output in your template. Then add the following code to the module override:
<?php 
/**
 * @version		2.6.x
 * @package		K2
 * @author		JoomlaWorks https://www.joomlaworks.net
 * @copyright	Copyright (c) 2006 - 2014 JoomlaWorks Ltd. All rights reserved.
 * @license		GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
 */

// no direct access
defined('_JEXEC') or die;

?>
<div id="k2ModuleBox<?php echo $module->id; ?>" class="k2ArchivesBlock<?php if($params->get('moduleclass_sfx')) echo ' '.$params->get('moduleclass_sfx'); ?>">
  <ul>
    <?php $counter = 1; foreach ($months as $month): ?>
    <?php if($counter < 7): ?>
    <li>
      <a href="<?php echo $month->link; ?>">
        <?php echo $month->name.' '.$month->y; ?>
        <?php if ($params->get('archiveItemsCounter')) echo '('.$month->numOfItems.')'; ?>
      </a>
    </li>
    <?php endif; ?>
    <?php $counter++; endforeach; ?>
  </ul>
</div>

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

More
11 years 10 months ago #127633 by ilan
Replied by ilan on topic Re: K2 Archives
Thanks a lot, will see if I can try it.

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

More
11 years 10 months ago #127634 by irina
Replied by irina on topic Re: K2 Archives
Hi, this works like a charm!

I know I'm hijacking the post, but how do I make this show all months in the archive, my blog is many years old.

I did it somehow for the older version of K2, but I can't find it for 2.6.8.
Thanks a lot!
Irina

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

More
11 years 10 months ago #127635 by Lefteris
Replied by Lefteris on topic Re: K2 Archives
@irina

Hi. You cannot do this without hacking core K2 files which is not a good idea. The module is always displaying the last 12 months.

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

More
11 years 10 months ago #127636 by irina
Replied by irina on topic Re: K2 Archives
I was afraid of that. Thanks for the answer, Lefteris!

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

More
11 years 10 months ago #127637 by Lefteris
Replied by Lefteris on topic Re: K2 Archives
You are welcome.

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

More
11 years 4 months ago #127638 by meysam hosseini
Replied by meysam hosseini on topic Re: K2 Archives
Hi

is it possible to link like that:

last month - last 3 month - last 6 month?

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

More
11 years 4 months ago #127639 by Lefteris
Replied by Lefteris on topic Re: K2 Archives
@meysam hosseini

No, unfortunately not.

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


Powered by Kunena Forum