CMS Made Simple Forums

[Solved] scope=global
Page 1 of 1

Author:  jce76350 [ Mon Aug 24, 2015 8:23 pm ]
Post subject:  [Solved] scope=global


last rev 10109 Working on a multilingual web site FR, En, Es, De, with CGSimpleSmarty2.0

I use in the template at the top
{assign var='rootlang' cgsimple::get_root_alias() scope=global}
{global_content name="languagestrings_`$rootlang`"}
With some string translation on my template
But Have a lot of errors message on my translation (languagestrings)

To have no error message
I comment at the top atfer {process_pagedata}
{*assign var='rootlang' cgsimple::get_root_alias() scope=global*}
{*global_content name="languagestrings_`$rootlang`"*}
I must write after </__body>
{assign var='rootlang' cgsimple::get_root_alias()}
{global_content name="languagestrings_`$rootlang`"}
and write after <head>
{assign var='rootlang' cgsimple::get_root_alias()}
{global_content name="languagestrings_`$rootlang`"}

Is there a problem now (Smarty 3.1.16) with scope=global ?

Author:  calguy1000 [ Tue Aug 25, 2015 3:33 pm ]
Post subject:  Re: scope=global

First, your syntax is incorrect.

{assign var='rootlang' value=cgsimple::get_root_alias() scope=global} is the correct syntax.

Now. Given that there is a bug in CGSimpleSmarty for 2.0 (fixed in svn, thank you for the report). I tested this with other variable names at the top of my page template and it worked exactly as expected.

i.e: {assign var='test1' value='foo1' scope=global} or {$test2='foo2' scope=global}

note: that {assign var='test3' value='foo3'} (which does NOT have the global scope argument) also worked as expected. When I tried to reference the {$test3} variable in my page content the variable was not set and I got PHP notices.

Author:  jce76350 [ Tue Aug 25, 2015 5:54 pm ]
Post subject:  Re: scope=global

Ok solved

On my tests
are same working

But I must write after <head> and </__body>
{global_content name="languagestrings_`$rootlang`"}

Thanks for correction on CGSimpleSmarty module

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group