Templating....

Author Message

Ammar Ibrahim

Wednesday 08 November 2006 4:26:32 am

I'm new to ez templates, anyhow I would like to create a global variable that I want to be available to all templates. I want to have both Arabic & English sites use the same templates, I kinda have a formula to use the same template for both.

In order to do this, I need to have two variables $dir and $opoDir (opposite dir). The direction should be related to the language, if i'm in the arabic site, dir should "rtl".

How should this be done?

Jacobo Quiles

Wednesday 08 November 2006 7:28:53 am

Hi!

You should create a siteaccess for your english site and another for your arabic one.

In the arabic siteaccess create a site.ini.append file with the needed settings and add this one:

[SiteSettings]
Dir=rtl

In the english one, do the same but set the Dir to ltr:

[SiteSettings]
Dir=ltr

Then in your pagelayout, whenever you need to fetch the direction, you can try this:

{def $dir = ezini( 'SiteSettings', 'Dir', 'site.ini' )}

<html dir="{$dir}">

When user is seeing the english page, the english siteaccess will be loaded and the site.ini setting refearing to the direction will point to ltr. When seeing the arabic, will load rtl.

Microblau SL
http://www.microblau.net

Xavier Dutoit

Wednesday 08 November 2006 7:46:43 am

If you prefer not to add custom parameters to the site.ini, you can create your own files (eg directionsettings.ini.append.php ).

Modify the template example to fetch it into the right place.

X+

http://www.sydesy.com

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

Main resources:

Total runtime1.2396 sec
Peak memory usage4,096.0000 KB
Database Queries59

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0106 587.7813152.6094
Module start 'layout' 0.01060.0070 740.390639.3906
Module start 'content' 0.01771.2204 779.7813573.7500
Module end 'content' 1.23810.0015 1,353.531312.2031
Script end 1.2395  1,365.7344 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00430.3482160.0003
Check MTime0.00150.1211160.0001
Mysql Total
Database connection0.00180.146910.0018
Mysqli_queries1.155393.2025590.0196
Looping result0.00160.1260570.0000
Template Total1.188795.920.5943
Template load0.00220.175920.0011
Template processing1.186595.717020.5932
Template load and register function0.00030.025310.0003
states
state_id_array0.00140.114810.0014
state_identifier_array0.00220.181220.0011
Override
Cache load0.00190.1523250.0001
Sytem overhead
Fetch class attribute can translate value0.00180.143930.0006
Fetch class attribute name0.00240.190050.0005
XML
Image XML parsing0.01020.821630.0034
class_abstraction
Instantiating content class attribute0.00000.001050.0000
General
dbfile0.01040.8390230.0005
String conversion0.00000.001440.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/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.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: 14
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs