Problems, need help? Have a tip or advice? Post it here.
2 posts Page 1 of 1
I have created a blog at http://www.akhar.tk. Everything is working fine and CouchCMS is great but I am facing a little problem. I have created blog_list.html on which I list all my posts. 5 posts are listed and user can see more posts by clicking next page button in pagination.

I placed a HTML table (go to homepage and check) on blog_list.html. I want that table to appear only on first page. Whenever user clicks on next page in pagination and moves to second page or any other page, the table should not appear.

I know "If" conditional tag has to be used to achieve this. So i wrapped up the table code with if condition. Check the code below.

<cms:if k_current_page=='1'>
......table code....
</cms:if>


When i place this code, the table completely disappears. It shows neither on first page nor on any other pages. I don't know which variable is correct to achieve this. Please suggest the solution. I will be very thankful to you.
Hi,

The 'k_current_page' variable is available within <cms:pages> loop to point to the current page being paginated.
I suppose your table is located outside the <cms:pages> block so it wouldn't help much.

To figure out the current page outside the cms:pages block, you may use the following -
Code: Select all
<cms:set my_page_num="<cms:gpc method='get' var='pg' default='1' />"/>

<cms:if my_page_num='1'>
    .. table ..
</cms:if>

Hope it helps.
2 posts Page 1 of 1