Sunday 14 November 2004 6:58:14 pm
Hi. This is my first post here, and I'm also fairly new to EZ Publish to please bear with me. What I've got is a site with a front-page layout. This layout is shared by the 4 major nodes (Corporate Profile, Products & Services, Customer Care, and User Support), but there's a piece of stock photography (and also a <body>> class) which is different for each node (so we can separately brand each one).
What I'd like to know is: What's the best way to handle this? With override templates? Ideally I'd like to be able to use the same template, and just swap the class/photo with some kind of logic. (so use an if statement or a switch inside the template) Also, is there any way of associating nodes/objects with pages NOT using a numeric id? This site has to be transported to a full production server and I'd rather not have to re-create all the nodes and then rewrite all my overrides.
<b>Edit</b> It seems that the section ID is blank on refresh so the following code:
<div id="stockphoto">{switch match=$node.object.section_id}
{case match=6}<img src={"corporate_profile.jpg"|ezimage} width="562" height="200" border="0" alt="corporate profile" />{/case}
{case match=7}<img src={"products_services.jpg"|ezimage} width="562" height="200" border="0" alt="products and services" />{/case}
{case match=8}<img src={"customer_care.jpg"|ezimage} width="562" height="200" border="0" alt="customer care" />{/case}
{case match=9}<img src={"user_support.jpg"|ezimage} width="562" height="200" border="0" alt="user support" />{/case}
{case}<img src={"frontpage.jpg"|ezimage} width="562" height="200" border="0" alt="" />{/case}
{/switch}</div>
Returns the default case on refresh, when it returned one of the matches on the first run. This seems like strange behaviour. Debugging reveals: $node.object.section_id
to be blank on the refresh, so it doesn't match any of the cases.
|