language links in multilanguage websites with cache ON

Author Message

Yves Lescribe

Monday 14 August 2006 3:11:52 am

Hello,

I'm building new multilanguage websites and I have some problems with language links.
I have read lot of pages on this forum since I use ezpublish (3.4) and there are no real official solution provided by ez team to access a node in another language...

The code I actually use is :

       {let languages=hash('dut-NL','sitenl', 'eng-GB','site', 'fre-FR','sitefr') all_translations=$node.object.current.translation_list}
       {let flag=hash('eng-GB', 'EN', 'fre-FR', 'FR','dut-NL', 'NL') 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('http://' , $languages[$translation.item.language_code],'.url/',$DesignKeys:used.url_alias)} title={$translation.item.language_code}>{$flag[$translation.item.language_code]}</a>{delimiter} - {/delimiter}
          {/section}
       {/section}
       {/let}{/let}

This works perfectly when view-cache is turned off... but that's not perfect because when cache is turned off, the time to load a page is >1sec .... a little bit too long, for info, when cache is turned on, this time becomes < 0.6 sec... Really better but language links deseapper from the second visit of a page...

After searching and reading a lot of this forum, I think the problem is that $node is not accessible torrough pagelayout when cache is turned on...

I have thus tried to use {include uri="design:language.tpl"} in my pagelayout but this doesn't change anything...

Another possible solution was found at http://ez.no/community/forum/general/dissapearing_menu but I can't made an override for every node...

Does anybody knows how to made a fully working language selection available on everypage when cache is turned on, but only for nodes that are translated ? I only want to see the language link when a node is translated... Otherwise the solution is easy : static links.

I'm sorry if an answer exists in the forum, I can't find it....

Thanks,
Yves

Kristof Coomans

Monday 14 August 2006 6:58:47 am

Hello Yves

Take a look at this topic: http://ez.no/community/forum/setup_design/page_refresh_causes_custom_meta_tags_etc_to_disappear
It answers your question about the issues with the $node variable in the pagelayout when view caching is turned on.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Yves Deschrijvere

Monday 14 August 2006 7:35:01 am

Hi Kristof,

Thank you very much, this works perfectly ! Great ! :-)

Yves

No limits, except those of your mind ...

Robin Muilwijk

Friday 15 December 2006 1:43:34 am

Hi,

I'm new to eZpublish and trying to make a multilanguage site. Where would I put that code? I'm trying to make language links to access another language, just as on ez.no, on the top right.

Thanks, Robin

Board member, eZ Publish Community Project Board - Member of the share.ez.no team - Key values: Openness and Innovation.

LinkedIn: http://nl.linkedin.com/in/robinmuilwijk // Twitter: http://twitter.com/i_robin // Skype: robin.muilwijk

André R.

Friday 15 December 2006 8:29:34 am

This thread is not really about multilingual sites, but you can follow links and discussion on these other threads:

http://ez.no/community/forum/setup_design/multilingual_setup
http://ez.no/community/forum/install_configuration/multi_lingual_content/re_multi_lingual_content__4

Some code to play with (given that you have english and france versions of your site):


<li{if "en"|eq($access_type.name)} class="current_siteaccess"{/if}>
 {if is_set($DesignKeys:used.url_alias)}
  <a href={concat( "http://example.com/en/", $DesignKeys:used.url_alias)} title="See this page in english">english</a>
{else}
  <a href={concat( "http://example.com/en/", $uri_string)} title="See this page in english">english</a>
{/if}
 </li>

<li{if "fr"|eq($access_type.name)} class="current_siteaccess"{/if}>
 {if is_set($DesignKeys:used.url_alias)}
  <a href={concat( "http://example.com/fr/", $DesignKeys:used.url_alias)} title="See this page in french">french</a>
{else}
  <a href={concat( "http://example.com/fr/", $uri_string)} title="See this page in french">french</a>
{/if}
 </li>

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 19 2025 00:14:46
Script start
Timing: Jan 19 2025 00:14:46
Module start 'layout'
Timing: Jan 19 2025 00:14:46
Module start 'content'
Timing: Jan 19 2025 00:14:47
Module end 'content'
Timing: Jan 19 2025 00:14:47
Script end

Main resources:

Total runtime0.9227 sec
Peak memory usage4,096.0000 KB
Database Queries69

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0069 589.2891152.6563
Module start 'layout' 0.00690.0038 741.945339.5078
Module start 'content' 0.01080.9100 781.4531696.4922
Module end 'content' 0.92080.0019 1,477.945316.1094
Script end 0.9227  1,494.0547 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00300.3302160.0002
Check MTime0.00120.1328160.0001
Mysql Total
Database connection0.00130.136910.0013
Mysqli_queries0.856292.7901690.0124
Looping result0.00090.1021670.0000
Template Total0.885195.920.4425
Template load0.00210.223020.0010
Template processing0.883095.699120.4415
Template load and register function0.00020.026210.0002
states
state_id_array0.00160.177510.0016
state_identifier_array0.00170.187820.0009
Override
Cache load0.00170.1845380.0000
Sytem overhead
Fetch class attribute can translate value0.00070.073850.0001
Fetch class attribute name0.00170.181880.0002
XML
Image XML parsing0.00220.239450.0004
class_abstraction
Instantiating content class attribute0.00000.002280.0000
General
dbfile0.00140.1490310.0000
String conversion0.00000.001040.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
9content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 25
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs