Sunday 04 October 2009 3:48:11 am
Hi all, In my flat_left.tpl menu file I added the following in order to change css class depending on the href link I click on and which which link name is specified in my $view_parameters in URL. Here's the code
{def $current_year = currentdate()|l10n('shortdate')|extract(6,4)}
{def $year_param = $module_result.view_parameters.year}
{if is_set($year_param)|not}
{set $year_param = $current_year}
{/if}
{def $current_node = fetch('content','node',hash('node_id', $module_result.content_info.node_id))}
Archives
{for $current_year to 2005 as $year}
<a {if $year_param|eq($year)}class="selected"{/if} href="{concat($current_node.url, '/(year)/', $year)|ezurl(no)}">{$year}</a>
{if $year|ne(2005)}-{/if}
{/for}
The aim of the above code is to check if there is a year specified as parameter in the URL. If there's a parameter specified in the URL, that means that the user has clicked on an archive Year and I must change the style of the link he clicked on to declare it as "selected', and this doesn't work. This part of code if not working :
<a {if $year_param|eq($year)}class="selected"{/if} href="{concat($current_node.url, '/(year)/', $year)|ezurl(no)}">{$year}</a>
{if $year|ne(2005)}-{/if}
The $year value stays on the first value loaded in cache and every time I click on a new value of year (or if I change it in the URL) it's alway this cached value which is selected... I tried to uncache the left menu using this
{set-block scope=global variable=cache_ttl}0{/set-block}
... but it doesn't work. A help would be appreciated as I spent a lot of time to try to find solution on ez.no without big success. Many thanks to all of you.
|