String as parameter in ezini

String as parameter in ezini

Friday 02 September 2005 7:55:06 am - 6 replies

Author Message

Kirill Subbotin

Monday 05 September 2005 9:00:01 am

This usually happens when you use template compilation, because ezini gets compiled to just a static value. This is done to increase speed and should work this way.

You can probably get this work by disabling template compilation, but I suggest you to try this:

def $currency_name=ezini('Currency', 'ShortName', 'nor-NO.ini', 'share/locale', true)}

This is a way of dynamic fetching of ini settings, it is still undocumented, but should work in ez publish 3.6 or higher.

And please reply, does it work for you or not ?

Petter Arneson

Monday 05 September 2005 11:21:00 am

Thanks.

The line you wrote worked fine. I'm using v. 3.6.1.

But I still can't get any further with my problem.
I want to fetch the locale settings from RegionalSettings, and then fetch the currency from the specified locale. If someone uses greek as locale, the snippet should get the currency settings from the greek .ini file. What I'm trying to do is calculate a products price in Euro, using the eurofxref extension (which by the way is excellent).


{def $ini_file=ezini('RegionalSettings', 'Locale')|append('.ini')}
{def $currency_short_name=ezini('Currency', 'ShortName', $ini_file)}

{let rates=fetch( 'eurofxref', 'fxref' )}
  Your currency in Euro: {rates.fx.$currency_short_name|110n( 'number' )}
{/let}

www.vzt.no

Kirill Subbotin

Tuesday 06 September 2005 1:10:55 am

You can try to change your second line to this:

{def $currency_short_name=ezini('Currency', 'ShortName', $ini_file, 'share/locale', true)}

Petter Arneson

Tuesday 06 September 2005 2:07:15 am

Jupp, that did the trick!

Thanks Kirill.

www.vzt.no

Christopher Grondahl

Wednesday 15 September 2010 1:50:56 pm

Trying to make Kirill's string work on 3.10 without results. Any changes in how eZ displays site currency on later releases?

Here's the code I'm trying to get going:

{def $ini_file=ezini('RegionalSettings', 'Locale')|append('.ini')}
{def $sitecurrency=ezini('Currency', 'ShortName', $ini_file, 'share/locale', true)}
            
{$sitecurrency}

Chris

ez site: http://www.acem.no

Every day is Groundhog Day

Christopher Grondahl

Wednesday 15 September 2010 2:58:57 pm

A friend helped me out, here's the code that actually works - if it can be of any help to other stuck in the same challenge:

 {def $ini_file=ezini('RegionalSettings', 'Locale')|append('.ini')}
 {def $sitecurrency=ezini('Currency', 'ShortName', '../share/locale/'|append($ini_file), true(), true() )}

Chris

ez site: http://www.acem.no

Every day is Groundhog Day

You must be logged in to post messages in this topic!

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