Best way to get current language?

Author Message

Kai Duebbert

Sunday 28 September 2003 2:33:10 am

Hi,

What's the best way to get the current language? If I use $node, then it only works *before* caching. If I use $module_result.content_into.language, then it only works *after* it has been cached. Do I really have to test which one is set?

What's the best solution?

Thanks,
Kai

Kai Duebbert

Sunday 28 September 2003 7:08:20 pm

I'm using this at the moment, in case anyone is interested or has a better solution:

{let language=false()}
{section show=is_set($module_result.content_info.language)}
{set language=$module_result.content_info.language}
{section-else}
{set language=$node.object.default_language}
{/section}
[...]
{/let}

Vivienne van Velzen

Monday 29 September 2003 11:21:51 pm

Hi Kai,

It's not the solution to your problem, but it does explain when to use $node and when $module_result. Maybe it'll help.

http://www.ez.no/developer/ez_publish_3/forum/setup_design/node_module_result_designkeys_question

Greetings,

Vivienne

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 18 2025 22:25:20
Script start
Timing: Jan 18 2025 22:25:20
Module start 'layout'
Timing: Jan 18 2025 22:25:20
Module start 'content'
Timing: Jan 18 2025 22:25:21
Module end 'content'
Timing: Jan 18 2025 22:25:21
Script end

Main resources:

Total runtime1.1287 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0046 589.0547152.6250
Module start 'layout' 0.00460.0034 741.679739.4453
Module start 'content' 0.00801.1190 781.1250468.1875
Module end 'content' 1.12700.0016 1,249.31258.1563
Script end 1.1286  1,257.4688 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00380.3325160.0002
Check MTime0.00130.1129160.0001
Mysql Total
Database connection0.00060.055310.0006
Mysqli_queries1.082495.8983570.0190
Looping result0.00060.0551550.0000
Template Total1.092896.820.5464
Template load0.00190.164120.0009
Template processing1.091096.660920.5455
Template load and register function0.00020.018510.0002
states
state_id_array0.00100.092410.0010
state_identifier_array0.00130.115720.0007
Override
Cache load0.00150.1316240.0001
Sytem overhead
Fetch class attribute can translate value0.00050.040220.0002
Fetch class attribute name0.00100.090830.0003
XML
Image XML parsing0.00030.029320.0002
class_abstraction
Instantiating content class attribute0.00000.000630.0000
General
dbfile0.00070.0595100.0001
String conversion0.00000.000940.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
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 12
 Number of unique templates used: 5

Time used to render debug report: 0.0001 secs