Forums / Setup & design / language links in multilanguage websites with cache ON

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

eZ debug

Timing: Jan 18 2025 21:12:19
Script start
Timing: Jan 18 2025 21:12:19
Module start 'content'
Timing: Jan 18 2025 21:12:20
Module end 'content'
Timing: Jan 18 2025 21:12:20
Script end

Main resources:

Total runtime1.1568 sec
Peak memory usage4,096.0000 KB
Database Queries206

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0062 589.0859180.8125
Module start 'content' 0.00621.0153 769.8984701.6016
Module end 'content' 1.02150.1351 1,471.5000341.0391
Script end 1.1567  1,812.5391 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00420.3673210.0002
Check MTime0.00160.1347210.0001
Mysql Total
Database connection0.00090.073910.0009
Mysqli_queries1.073892.82862060.0052
Looping result0.00220.18992040.0000
Template Total1.124797.220.5623
Template load0.00220.191320.0011
Template processing1.122497.031920.5612
Template load and register function0.00020.013010.0002
states
state_id_array0.00120.100710.0012
state_identifier_array0.00130.114020.0007
Override
Cache load0.00190.1614380.0000
Sytem overhead
Fetch class attribute can translate value0.00170.147560.0003
Fetch class attribute name0.00090.081180.0001
XML
Image XML parsing0.00220.192960.0004
class_abstraction
Instantiating content class attribute0.00000.001180.0000
General
dbfile0.00530.4584420.0001
String conversion0.00000.000530.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 25
 Number of unique templates used: 7

Time used to render debug report: 0.0003 secs