Simon Phillips
|
Tuesday 15 February 2005 4:38:10 am
Hi, I'm trying to add node translation information to a menubar - specifically, I want to include the following language link code in a menubar that's specified in pagelayout.tpl:
{* Code to show list of translations *}
{* to use pictures, instead of text uses st.like this: 'esl-ES',concat('<img src=',"picture_name.png"|ezimage,'/>') *}
{let languages=hash('cat-ES','Catalan', 'chi-CN','Chinese', 'cze-CZ','Czech', 'dan-DK','Danish', 'dut-NL','Dutch', 'eng-CA','English (Canada)', 'eng-GB','English (United Kingdom)', 'eng-US','English', 'esl-ES','Español', 'esl-MX','Castillan', 'fin-FI','Finnish', 'fre-CA','French (Canada)', 'fre-FR','Français', 'ger-DE','German (Germany)', 'hun-HU','Hungarian', 'ita-IT','Italian', 'nno-NO','Norwegian (Nynorsk)', 'nor-NO','Norwegian (Bokmal)', 'pol-PL','Polish', 'por-BR','Portuguese (Brasil)', 'por-MZ','Portuguese (Mozambique)', 'por-PT','Portuguese (Portugal)', 'rus-RU','Russian', 'swe-SE','Swedish')
all_translations=$node.object.current.translation_list}
{section show=$all_translations|count|gt(0)}
{section var=translation loop=$node.object.current.translation_list}
<a href={concat($node.url_alias,'/(language)/',$translation.item.language_code)|ezurl}>{$languages[$translation.item.language_code]}</a> |
{/section}
{/section}
{/let}
However, this only displays on the first view of the page after a cache clear; Subsequent views (loaded from the template cache) don't work because this references $node and not $module_result - which is not available at the pagelayout level (http://www.ez.no/ez_publish/documentation/customization/custom_design/template_variables_set_by_ezpublish) Unfortunately, $module_result doesn't hold any translation data, so I can't select on that instead. How else can I display this translation info? The obvious alternative is to put it in a view-level template; but this means that I'll need to put a fair amount of site structure at the view level - ie menu bars, etc - and since I already customise my view/content/full.tpl files for different content types, I don't want to have to edit each of these each time I want to change a bit of structure. How does everyone else handle this sort of thing? Can I force a template block to be <b>not cached</b>?
Thanks, Simon
|