Articles filtered by year menu items

General questions relating to Joomla! 3.x.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
Post Reply
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Sun Nov 18, 2007 8:12 pm

Articles filtered by year menu items

Post by aefferen » Thu Jul 15, 2021 9:45 pm


I have this website with all Lego technic sets listed; ... 2-09-30-07. Fun to browse.
Next to that the same list by year: ... ts-by-year.
I am at the latest Joomla 3.9.28.
What I want to create is a menu structure:
Each time when you select a year-menu item only the articles with creation date of that year will be shown.
I can't get this to work. I would expect this can be done with vanilla joomla, seems to me basic functionality.

I created modules with dynamic set and date ranges but didn't show anything and what ever menu-item-type I select a date range filter is not available.
In this context archiving is not applicable, however if someone knows how to 'misuse' it I am all ears.

After browsing this forum for this topic without result I decided to post my question.
Thanks for any hints, upfront

Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Tue Jul 27, 2021 1:52 am

Re: Articles filtered by year menu items

Post by embedNZ » Fri Jul 30, 2021 5:41 am

I would suggest just creating your menu items for your years manually. link all items to the same page and just apply a filter on your main items array before out putting the data.


just loop through before outputting and unset anything you don't need. ie:

Code: Select all

<?php foreach ($this->items as $i => $article) : ?>
	<?php if ($article->date > $_GET['y']) : ?>
	//either use 
	//or unset and loop through output again.
	<?php endif;?>
<?php endforeach; ?>
Ideally this should allow you to only display the years you want?

Post Reply

Return to “General Questions/New to Joomla! 3.x”