LOOP on Pages?

General ShopSite user discussion

LOOP on Pages?

Postby davee123 » Tue Oct 09, 2007 8:38 am

Hi, I'm rather new to Shop Site-- actually I'm a Perl web developer who's trying to lend some assistance to a friend who's using Shop Site. Anyway.

I'm attempting to create a sidebar for the site-- basically the sidebar should go through and list all the available "Pages" within ShopSite, and print out the corresponding links.

So, it looks like I COULD do this with a [-- LOOP LINKS --] call, but this seems wrong to me. That is, if I did it that way, I would then have to associate every Page with every other Page, rather than just a global list of all Pages.

Another way that I could see doing (this seems even wronger) is to write my own program that could dynamically generate the sidebar, and then include it in a [-- CALL --] tag. But that would also require either some hard-coding or some sort of accessor for the Shop Site config files (looks like it's mostly in SQL Lite?).

But it seems what would be nice (does it exist?) is to have some sort of a global tag for [-- LOOP PAGES --] that would wrap a loop around each Page in the Shop Site database.

Are there other ways this is possible? That is, how can I get a dynamically generated list of all the available pages and loop around them?

DaveE
davee123
 
Posts: 8
Joined: Tue Oct 09, 2007 7:56 am
Location: Massachusetts, USA

Postby loren_d_c » Tue Oct 09, 2007 9:25 am

There is no LOOP PAGES or anything similar that would loop through all of the pages in ShopSite.

Your best bet for this would be to have one page for your 'navigation' page and assign all other pages to it, and have a special page template for it so that the links all layout like you want them, then include the HTML page created by this page record in all of your other pages via a Server Side Include.

Then any time you add new pages or want to remove pages from the navigation or want to re-arrange pages in the navigation you only have to do it to this one page, and the results will automatically be seen in all other pages via the SSI.

-Loren
loren_d_c
 
Posts: 2572
Joined: Fri Aug 04, 2006 12:02 pm
Location: Anywhere

Postby davee123 » Tue Oct 09, 2007 10:27 am

loren_d_c wrote:Your best bet for this would be to have one page for your 'navigation' page and assign all other pages to it, and have a special page template for it so that the links all layout like you want them, then include the HTML page created by this page record in all of your other pages via a Server Side Include.


Hm. Except then it's not available to have any [-- PAGE.field --] variables interpreted corresponding to the context of the Page doing the including. I had been hoping to create the sidebar a little more dynamically-- that is, the sidebar would have a list of Pages, but it would skip some or display some as sub-pages depending on what those Pages' extra fields were set to.

Hm. I suppose it might be possible to use your suggested method if the include were able to pass a parameter to the NAV page? Effectively you could pass (say) PAGE.Field1 to the NAV page as a parameter within the SSI, it's just that the NAV page would have to be able to interpret parameters. I haven't noticed this in the documentation yet-- is it possible to look at the page parameters? Something like PARAM.foo?

DaveE
davee123
 
Posts: 8
Joined: Tue Oct 09, 2007 7:56 am
Location: Massachusetts, USA


Return to User Forum

Who is online

Users browsing this forum: No registered users and 96 guests