Problems, need help? Have a tip or advice? Post it here.
17 posts Page 2 of 2
Patrick,

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.
Kamran,

You are a star! thanks so much for taking the time to explain and provide the snippet, it makes total sense, I understand this approach now and should be able to draw upon it for any similar future requirements.
Is it possible to run multiple site instances from a single Couch folder that's outside the site root?

I'm afraid, no.

It really had nothing to do with enforcing the license. The way Couch calculates a template's name (remember the name has the entire folder(s) hierarchy prefixed to its name if it is not in the root) made it necessary to have a fixed relation between Couch's installation folder and the site's root - Couch always assumes it is the direct child folder of the site being managed.

Of course, this could have been managed by making the user define all relations himself (so as not to make Couch make the assumptions) but I thought it would only add an element of complexity that is best avoided.

Maybe, in the future we can have multi-install as an optional feature for those who are ready to tackle the complexity :)

EDIT: Seems you edited to remove your question.
Hi KK - yes sorry I moved it to a PM because I didn't want to pollute the thread.

Totally get where your coming from, no problem - it was just a thought and to be honest, it's not going to be a huge requirement in 99% of situations.

In terms of "one click updates" would something like that be possible / a future releases?
In terms of "one click updates" would something like that be possible / a future releases?

To tell the truth, I never seriously gave that a thought.
One reason was that I found people generally wary of anything on their site 'calling back home' - this is particularly so for scripts that are not open-source.

Anyways, I think it won't be long now before Couch also goes the open-source way so this feature would definitely get in then.
Hi KK, I was interested that you mentioned that Couch is likely to become 'open source' - what is your thinking behind this move? What are the implications for us Couch users? Presumably no need for Ioncube?
@potato,
Going open-source is a topic I've been wanting to discuss with the community about.
Please wait for a while - I'll post about it in a separate thread soon.
Thanks
17 posts Page 2 of 2
cron