Forum for discussing general topics related to Couch.
3 posts Page 1 of 1
Hey,

I'm setting up a very simple agenda and I can't get any result for future posts.

I have two posts: one published in 1999 and another set as published for 2050.
The 1999 displays correctly on the "PAST" but I don't get any results to display the 2050 in "FUTURE". Any idea what's missing?

Code:

Code: Select all
<cms:set cur_date="<cms:date format='Y-m-d' />" />

<h1>FUTURE</h1>
<cms:pages show_future_entries='1'>
   <cms:if k_page_date gt 'cur_date' >
                <div class="row agenda-list">
             <div><cms:show k_page_title /> This is a post from 2050</div>
           </div>
        </cms:if>
</cms:pages>


<h1>PAST</h1>
<cms:pages show_future_entries='1'>
   <cms:if k_page_date lt 'cur_date' >
                <div class="row agenda-list">
             <div><cms:show k_page_title /> This is a post from 1999</div>
           </div>
        </cms:if>
</cms:pages>


Thanks :-)
Code: Select all
<cms:if k_page_date gt 'cur_date' >

You'll notice in the code above that you have used quotes with cur_date - that makes it literally a string (i.e. character 'c' followed by 'u' followed by 'r' etc.).

What you actually need in that comparision is the variable of that name. To get that, just remove the quotes e.g.
Code: Select all
<cms:if k_page_date gt cur_date >

If you need more details on this concept please see https://docs.couchcms.com/concepts/sett ... eters.html

Hope this helps
It works! And i've learned a new concept. Thanks a lot @KK you rock!
3 posts Page 1 of 1