Forum for discussing general topics related to Couch.
15 posts Page 2 of 2
@trendoman sorry I'm confused.

Basically I have the following posts:
[1] [2] [3] [4] [5] [6]

Each one of them should display "next" and "previous" posts.
So, by logic, post [3] displays:
[4] as next + [2] as previous

All good here. But for example, post [1] displays:
[2] as next + NOTHING as previous.

instead of "nothing" I would like it to display [6]

Anyone can give me a hint? Sorry for the ignorance, I'm kinda new to this stuff..
It will be less murky with example -
Code: Select all
<cms:pages stop_before=k_page_date limit='1'>
       <h5><cms:date k_page_date format='d.m.Y' /></h5>
       <h4><cms:show en_titulo /></h4>
    <cms:no_results>
        // HERE WE SHOW MOST LATEST (LAST) POST
    </cms:no_results>
</cms:pages>

  <cms:pages start_on=k_page_date order='asc' limit='1' offset='1'>
        <h5><cms:date k_page_date format='d.m.Y' /></h5>
        <h4><cms:show en_titulo /></h4>
      <cms:no_results>
        // HERE WE SHOW MOST EARLIEST (FIRST) POST
    </cms:no_results>
</cms:pages>


Do you know how to write code to fetch one single post using orderby, order and limit parameters of cms:pages?
Do you know how to write code to fetch one single post using orderby, order and limit parameters of cms:pages?


I do, and thank you so so much for this, works great!

Final question, if I'm using this technique on a different clonable template that is sorted by "weight" and not by it's publication date, instead of "k_archive_date" (within "start_before" and "start_on") what should I use?

Thanks for your patience
francisknightley wrote:
Do you know how to write code to fetch one single post using orderby, order and limit parameters of cms:pages?


I do, and thank you so so much for this, works great!

Final question, if I'm using this technique on a different clonable template that is sorted by "weight" and not by it's publication date, instead of "k_archive_date" (within "start_before" and "start_on") what should I use?

Thanks for your patience

I never heard it was possible out of the box. Pages, ordered by weight, are absolutely not dependent on page's date. To correctly determine which posts are "next" or "prev", a custom cms:query script is required. It is either that or a modification of original cms:pages tag. I can do both with some kind of interest involved.
I wish to add to my previous post with a link to another old thread that I just found had my reply with sample code - viewtopic.php?f=8&t=11980#p32655
With little modification to add first-last page links it can be used as is.
15 posts Page 2 of 2