Forums / General / Templating....

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