[Solved] scope=global

Forum rules
Only administrators can post or move items here.
Post Reply
jce76350
Beta Tester
Beta Tester
Posts: 1950
Joined: Mon May 29, 2006 1:20 pm
Location: Rouen

[Solved] scope=global

Post by jce76350 »

Hi,

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

I use in the template at the top

Code: Select all

{process_pagedata} 
{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 ?
Jean-Claude Etiemble
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: scope=global

Post by calguy1000 »

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.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
jce76350
Beta Tester
Beta Tester
Posts: 1950
Joined: Mon May 29, 2006 1:20 pm
Location: Rouen

Re: scope=global

Post by jce76350 »

Ok solved

On my tests
value=cgsimple::get_root_alias()
or
cgsimple::get_root_alias()
are same working

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

Thanks for correction on CGSimpleSmarty module
Jean-Claude Etiemble
Post Reply

Return to “Closed Issues”