Patrick,
Actually you had posted a pretty accurate description of what you wanted
I apologize for not studying that carefully enough.
I think, the following code does all that you stipulated:
A short explanation -
The cms:pages tag now uses a global variable named 'my_start_on' to set the beginning of the time-period of pages fetched.
At the very top, we unconditionally set this 'my_start_on' to the current date. So, by default, pages before the current date will never be shown.
However, when an archive link is clicked (deduced by 'k_archive_date' being set), we check if the archive period falls before or after the current date. If it falls after the current date, the 'my_start_on' is modified to begin from 'k_archive_date'. This way, now we get to see only pages belonging to a future time-period.
I'm assuming you'll use the cms:archives tag as it was used before (i.e. only showing future time periods).
Does this do what you wanted? Please let me know.
Actually you had posted a pretty accurate description of what you wanted
Is there any way of setting a variable or something to say - "Hey, you've not clicked a monthly archive (in this case future archive) link yet so lets display 25 upcoming entries from todays date" but when and archive link is clicked it detects this (possibly from the URL segment?) and says "wait, that current URL segment, or the month I am been asked to show is beyond todays date so I will treat anything older than the current month as a past entry"?
I apologize for not studying that carefully enough.
I think, the following code does all that you stipulated:
- Code: Select all
<cms:set my_start_on="<cms:date format='Y-m-d H:i:s' />" scope='global' />
<cms:if k_archive_date>
<cms:set cur_year="<cms:date format='Y' />" />
<cms:set cur_month="<cms:date format='n' />" />
<cms:if
cur_year lt "<cms:date k_archive_date format='Y' />" ||
(cur_year = "<cms:date k_archive_date format='Y' />" && cur_month lt "<cms:date k_archive_date format='n' />" ) >
<cms:set my_start_on=k_archive_date scope='global' />
</cms:if>
</cms:if>
<cms:pages start_on=my_start_on stop_before=k_next_archive_date show_future_entries='1' paginate='1' limit='25' orderby='publish_date' order='asc'>
... existing code ...
</cms:pages>
A short explanation -
The cms:pages tag now uses a global variable named 'my_start_on' to set the beginning of the time-period of pages fetched.
At the very top, we unconditionally set this 'my_start_on' to the current date. So, by default, pages before the current date will never be shown.
However, when an archive link is clicked (deduced by 'k_archive_date' being set), we check if the archive period falls before or after the current date. If it falls after the current date, the 'my_start_on' is modified to begin from 'k_archive_date'. This way, now we get to see only pages belonging to a future time-period.
I'm assuming you'll use the cms:archives tag as it was used before (i.e. only showing future time periods).
Does this do what you wanted? Please let me know.