ZenphotoCMS Forum
loop through ZenPage Pages - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: loop through ZenPage Pages (/thread-9276.html)



loop through ZenPage Pages - tunafish - 2011-11-17

Is there any way to loop through the ZenPage Pages?

I would like to print a list of Pages with title, date and content with 'read more' links when visiting the directory /zenphoto/pages/
Like when you do a search for a Page title.

I have found the next_page function but it seems only for search purposes.
In my theme's pages.php

// if there is no content it means we are looking at a blank pages.php if (!getPageContent()) { while (next_page()) : ; endwhile; }




loop through ZenPage Pages - sbillard - 2011-11-17

You will have to use the object model for this. The zenpage class has a method getPages() to return the database rows for all the pages. You would have to instantiate a page object for each within your loop.




loop through ZenPage Pages - tunafish - 2011-11-18

getPages()
Okay, that was very helpful!
Cheers :-)