Conditional statement in page template

General ShopSite user discussion

Conditional statement in page template

Postby beley » Wed Sep 20, 2006 11:24 am

I'm writing page template with several conditionals to minimize the code if certain options are unchecked or are not assigned.

So far here is what I have:

Code: Select all
[-- IF PAGE.NumLinks 0 --]
<!-- No Links -->
[-- ELSE --]
<table id="linkstable">
[-- LOOP LINKS PAGE.Columns --]
<td valign="top">[-- LINK --]</td>
[-- END_LOOP LINKS --]
</table>
[-- END_IF --]


It just doesn't work. I'm not sure how to structure the conditional and did not see many examples in the ShopSite Help.

How would I structure a conditional so that if there weren't any pages, links, products, etc. assigned that block of code was never generated or inserted into the page?

Thanks!
Brandon Eley
Certified ShopSite Designer
beley
 
Posts: 111
Joined: Sun Aug 06, 2006 10:05 am
Location: LaGrange, GA

Postby loren_d_c » Wed Sep 20, 2006 12:53 pm

What version of ShopSite are you using? I have v8.1.2 and I added the following code to my page template and tried it on a page with no assigned pages, on a page with one assigned page, and on a page with multiple assigned pages, and in all cases it returned the expected/correct results:

Code: Select all
[-- IF PAGE.NumLinks 0 --]
NO PAGE LINKS!
[-- ELSE --]
THERE ARE PAGE LINKS!
[-- END_IF --]


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


Return to User Forum

Who is online

Users browsing this forum: Bing [Bot] and 120 guests