Problems, need help? Have a tip or advice? Post it here.
8 posts Page 1 of 1
hello ... I'm using <cms:paginator simple='1' /> for the first time and am wondering if I can place another anchor between the prev and next. In the static version of the page I had three links set up : PREV BACK TO ALL EVENTS NEXT.

This allows the user to navigate back/forward through the events listing detail pages or return to the summary listing. The layout works neatly so it would be nice if it was possible, but not the end of the world if not!

Thanks
Hi potato,

That won't be possible with the 'paginator' tag but you can very easily do it manually (this is explained in http://www.couchcms.com/docs/concepts/pagination.html)
The following snippet mimics what simple paginator does. You can go ahead and add the third 'BACK TO ALL EVENTS' link in the middle.
Code: Select all
     <cms:if k_paginated_bottom >
        <cms:if k_paginate_link_prev >
            <a href="<cms:show k_paginate_link_prev />">prev</a>
        </cms:if>
        <cms:if k_paginate_link_next >
            <a href="<cms:show k_paginate_link_next />">next</a>
        </cms:if>
    </cms:if>

Hope this helps.
hi again, I've been grappling with pagination - I am trying to have pagination on the page view of a clonable template and am not sure if it's possible to do this or not ...

The clonable template is events.php. In list view I am showing all future events in list order (summary details).

Page view shows the full details of an event PLUS the pagination - PREV / NEXT. But at the moment the pagination only works when you click through from the first event. The problem with clicking through from a later event is that the pagination loses its position - I guess it's always starting at the next event coming up.

My code is as follows:
Code: Select all
<cms:if k_is_list >
                    

   <cms:pages masterpage='events.php'  order='asc' show_future_entries='1' start_on="<cms:date format='Y-m-d' gmt='1' />" >

      ..... event details  shown here ......
   
      <a href="<cms:show k_page_link />">Full details</a>

   </cms:pages> 

<cms:else />   
   
   <cms:pages masterpage='events.php'  order='asc' show_future_entries='1' start_on="<cms:date format='Y-m-d' gmt='1' />" limit='1' paginate='1'>
   
   
      <div class="pagination">
      
          <cms:if k_paginated_bottom >
              <cms:if k_paginate_link_prev >
                  <a href="<cms:show k_paginate_link_prev />">&#171; prev</a>
              <cms:else/>
                 <span class="page_disabled">&#171; prev</span>
              </cms:if>
             
              <a href="<cms:link 'events.php' />">back to all events</a>
             
              <cms:if k_paginate_link_next >
                  <a href="<cms:show k_paginate_link_next />">next &#187;</a>
              <cms:else/>
                 <span class="page_disabled">next &#187;</span>
              </cms:if>
          </cms:if>
         
          </div>
      
   </cms:pages>
   
</cms:if>


I've gone into a spin on this - am I missing something obvious?
Hi,

Please see viewtopic.php?f=2&t=21
Do let me know it it helps.
Have tried something like the code in the post you refer to, but cannot stop an event from the past being picked up.

Code: Select all
<div class="pagination">
                        
<cms:pages stop_before=k_page_date show_future_entries='1' order='asc' limit='1'>
   <a href="<cms:show k_page_link />">prev</a>
</cms:pages>

<cms:pages start_on=k_page_date show_future_entries='1' order='asc' limit='1' offset='1'>
   <a href="<cms:show k_page_link />">next</a>
</cms:pages>

</div


The other thing with this is that I would want to identify when there are no more events to be found in either direction and change the next/prev link to non active and greyed out. This may not be do-able.

I am now thinking I'll simply have to have a 'back to list' link from the individual event page and forget the idea of allowing navigation between individual event pages on the individual event pages themselves (in date published order).
Hi,

Could you please PM me the events template you are trying to put the pagination on?
Hi,

Please try the following code. It checks for the event not being older than the current time before showing it. It also applies the 'disabled' class to the links if events are not found.
Code: Select all
<cms:set current_date="<cms:date format='Y-m-d H:i:s' />" 'global' />
<cms:set prev_link='<a href="#" class="disabled">Prev</a>' 'global' />
<cms:pages stop_before=k_page_date show_future_entries='1' orderby='publish_date' order='desc' limit='1'>
   <cms:if k_page_date ge current_date >
      <cms:set prev_link="<a href=\"<cms:show k_page_link />\">(<cms:show k_page_title />) prev</a>" 'global' />
   </cms:if>
</cms:pages>

<cms:set next_link='<a href="#" class="disabled">Next</a>' 'global' />
<cms:pages start_on=k_page_date show_future_entries='1' orderby='publish_date' order='asc' limit='1' offset='1'>
   <cms:set next_link="<a href=\"<cms:show k_page_link />\">next  (<cms:show k_page_title />)</a>" 'global' />
</cms:pages>

<cms:show prev_link /> - <cms:show next_link />

Hope this helps.
Please let me know.
Thanks
Working perfectly thanks so much!

An extremely useful piece of code - I'm sure I'll be re-using it on other sites - and hope others will find it helpful too.
8 posts Page 1 of 1
cron