Forum
Filter by marked archived years.
Hi,
I have been working on filtering the news list based on years, it worked fine for me. But now I need to add another feature which is to mark any number of years as Archived and then when in my website UI, the user will click on "Archieve" it should show all the news in sorted order for all the years which where marked as Archive by the admin user.
For example: I have news for each of the years: 2010 to 2016 but now I mark years 2010-2012 as archived news. So when I would need to see all the achieved years news, I would click on Archive ad should be able to see them all.
Could you please help me with a way out of it?
How are you planning on marking those years?
I have given a checkbox with label "Archive" in the perch control panel, which is when checked of number of years will consider all these as archived news years.
Ok, so on your archive page, you'll need to fetch those values and then use them in your filter to get the news list.
Exactly this is what I want to do. Thanks for understanding Drew.
How can I do that, also the news should show up in sorted order (by date).
Which part are you struggling with? Have you fetched your archived years?
No, I will try explaining my concern again. When I mark a few years as Archive, it gets hidden from the filter pane (which is correct), now when I click on "Archive" option from the filter pane it should show news of all those years which were marked archive. This is what I need help with?
To elaborate on the issue, there are 2 different pages: 1. Perch control panel page; which has that archive check box. 2. PHP page where my news lists show up along with the filtering option.
Is there any way I can manage to link these 2 page code/items?
Hope this make sense to you now.
My code for perch control panel check box & filter item is as below:
My code on php News webpage is as below: 'News_master_page.php' this page is not getting called in the below, don't know why it is so.
I understand what you're trying to do. I've explained the steps, which you seem to agree with. What I don't understand is why you're not then doing that. Where are you stuck?
Have you got your list of archive years back? If not, where's the problem?
I'm not sure what this is or how it relates, but:
The
page
option needs to be root-relative, so starting with a/
.You're setting
filter
andmatch
but notvalue
, so there's nothing to filter on.