Forum for discussing general topics related to Couch.
2 posts Page 1 of 1
Hi,

I would like to show on the front page of my couch site the 2 most recent entries on a folder called listings. I only need to show the title, the date and an image I added as editable content (IE I don't need to show the whole entry contents).

Any help will be appreciated, thanks!
Hi,

Please consider the following sample code -
Code: Select all
<cms:pages masterpage='whatever.php' folder='whatever_folder_name' limit='2'>
    <h2><cms:show k_page_title /></h2>
    <cms:show k_page_date /><br>
    <img src="<cms:show whatever_image_field />" />
</cms:pages>

Explaining the code -
We use the 'masterpage' parameter of <cms:pages> to specify which template it should fetch the pages from.
The 'folder' parameter is used to specify the exact folder and finally the 'limit' parameter to specify the number of pages to fetch. By default, the cms:pages tag lists pages in descending order of their publish dates, so the code above will fetch the latest posts first.

You can specify the names of the fields to show them selectively (of course, you are free to use your own HTML markup).

Hope this helps.
2 posts Page 1 of 1