Problems, need help? Have a tip or advice? Post it here.
5 posts Page 1 of 1
Hello KK I have kept

<cms:pages masterpage='works.php' show_future_entries='1'>
<a href="<cms:show k_page_link />"> <cms:show k_page_title /></a>
</cms:pages>

I also used past_entries which is working fine.. but when i kept future entries tag it is displaying the past entries too .. that is dated on october 11th posts too.. I want only to display future entries in the column ..
I've never used the 'start_on' parameter before so I'm not sure how this would work with caching enabled or if it can accept hours, minutes, and seconds. Maybe KK can shed some light on the matter.
Code: Select all
<cms:pages masterpage='works.php' start_on="<cms:date format='Y-m-d' />" show_future_entries='1'>
   <a href="<cms:show k_page_link />"><cms:show k_page_title /></a>
</cms:pages>

I should point out, it takes much more time to post something on the forums and wait for a reply than to read the documentation for a specific tag: http://www.couchcms.com/docs/tags-reference/pages.html
@cheesypoof,

Using the 'start_on' parameter is the right solution.
The parameter accepts hours, minutes, and seconds so the following snippet will always fetch pages that have a date future to the current instant (precise to the second)
Code: Select all
<cms:pages masterpage='works.php' start_on="<cms:date format='Y-m-d H:i:s' />" show_future_entries='1'>
   <a href="<cms:show k_page_link />"><cms:show k_page_title /></a>
</cms:pages>

You are right about the caching issue though. Cached output will not play fair with this calculating of the future date dynamically.
A solution to this would be to selectively turn off caching for the particular template (or even a specific view) that has this snippet by using this
Code: Select all
<cms:no_cache />
I have an events listing page using start_on / show_future_entries and I've turned caching on ... having read these postings I understand now that an event in the past could well be displayed in this scenario.

Does <cms:no_cache /> need to be placed anywhere in particular?
@potato
Let us say following is a skeletal outline of a template
Code: Select all
<cms:if k_is_list>
   // show list of pages
<cms:else />
   // show single page
</cms:if>

If you place the <cms:no_cache /> outside any view e.g. as follows
Code: Select all
<cms:no_cache />
<cms:if k_is_list>
   // show list of pages
<cms:else />
   // show single page
</cms:if>

all the views of the template will skip getting cached.
However if we place the tag in a particular view only that view escapes getting cached e.g. the following prevents only the list view from getting cached
Code: Select all
<cms:if k_is_list>
   // show list of pages
   <cms:no_cache />
<cms:else />
   // show single page
</cms:if>

while the following prevents only the page-views from getting cached.
Code: Select all
<cms:if k_is_list>
   // show list of pages
<cms:else />
   // show single page
   <cms:no_cache />
</cms:if>

You can exert even finer control by checking for a particular page_name or folder_name and using the tag there to make that particular page or folder skip getting cached, but usually that won't be necessary.

As to where you should keep the tag really depends on which view is using any dynamic parameter and shouldn't be cached.

Hope this helps.
5 posts Page 1 of 1
cron