Wednesday 30 May 2007 4:12:26 pm
Hi Kristoffer I have banners which are determined by both the subtree folder and a selection switch in the content items, so you can select one of three banners for each section. The actual banners are inserted by adding a stylesheet in the head of the document. You'll need to add a template include in the head of your pagelayout. First, make the $node variable work again, new in eZpublish 3.9!
{if and( is_set($module_result.node_id), is_unset($node) )}
{def $node = fetch( content, node, hash( node_id, $module_result.node_id ) )}
{/if}
Second, build the first half of the stylesheet link (replace the strings with your own folder names):
<link rel="stylesheet" type="text/css" href="/design/news_site/stylesheets/banners/
{if $requested_uri_string|begins_with( 'about' )}
about-
{elseif $requested_uri_string|begins_with( 'your_council' )}
your-council-
{elseif $requested_uri_string|begins_with( 'community' )}
community-
{elseif $requested_uri_string|begins_with( 'library' )}
library-
{elseif $requested_uri_string|begins_with( 'tourism' )}
tourism-
{elseif $requested_uri_string|begins_with( 'contact' )}
contact-
{elseif $requested_uri_string|begins_with( 'search' )}
search-
{elseif $requested_uri_string|begins_with( 'help' )}
help-
{else}
{/if}
Third, test for the value of the user selection:
{if eq($node.data_map.banner_selection.data_text,'0')}
banner-1
{elseif eq($node.data_map.banner_selection.data_text,'1')}
banner-2
{elseif eq($node.data_map.banner_selection.data_text,'2')}
banner-3
{else}
banner
{/if}
Finally, finish off the css link.
.css" />
If you replace the <>'s in the tag while you are messing around you'll be able to see the result in your browser.
Paul Bolger
|