I'm trying to get our website using MleCMS to work with CMSMS 2.0.
Now I got it basically working, but there is on problem.
At the beginning of site template I have {MleCMS action="init"}, which sets global variables lang_parent, lang_locale, lang_dir with $smarty->assignGlobal
But {$lang_locale} returns empty string until after html head tag (when it starts to show correct values).
For debugging I added (inside html comments)
lang_locale="{$lang_locale}"
{get_template_vars}
into main template after module init... $lang_locale is empty, but get_template_vars shows it having value.
I'm using CMSMS 2.1.4
Visibility of global smarty variables
Re: Visibility of global smarty variables
And I solved problem currently with UDT containing:
$smarty->assign('lang_dir', $smarty->get_template_vars('lang_dir'));
$smarty->assign('lang_locale', $smarty->get_template_vars('lang_locale'));
$smarty->assign('lang_parent', $smarty->get_template_vars('lang_parent'));
$smarty->assign('lang_dir', $smarty->get_template_vars('lang_dir'));
$smarty->assign('lang_locale', $smarty->get_template_vars('lang_locale'));
$smarty->assign('lang_parent', $smarty->get_template_vars('lang_parent'));
Re: Visibility of global smarty variables
It might be an issue with smarty caching of the variable. I am not sure how to fix it.
- Rolf
- Dev Team Member
- Posts: 7825
- Joined: Wed Apr 23, 2008 7:53 am
- Location: The Netherlands
- Contact:
Re: Visibility of global smarty variables
Code: Select all
{MleCMS action="init"}
{$lang_dir=$lang_dir scope=global}
{$lang_locale=$lang_locale scope=global}
{$lang_parent=$lang_parent scope=global}
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Re: Visibility of global smarty variables
Yeah, that's basically what my solution does. But strange thing is, that I modified MleCMS to set those variables with AssignGlobal. So they are in global scope. Before that change those variables were not visible at any part of template. After that they become visible after "head" tag.Rolf wrote:http://www.cmscanbesimple.org/blog/smar ... e-examplesCode: Select all
{MleCMS action="init"} {$lang_dir=$lang_dir scope=global} {$lang_locale=$lang_locale scope=global} {$lang_parent=$lang_parent scope=global}
Re: Visibility of global smarty variables
Probably. But since I was able to work around the issue, that's no longer major issue for me. But I should probably publish somewhere the changes I made to MleCMS to get it working.Jeff wrote:It might be an issue with smarty caching of the variable. I am not sure how to fix it.
- Rolf
- Dev Team Member
- Posts: 7825
- Joined: Wed Apr 23, 2008 7:53 am
- Location: The Netherlands
- Contact:
Re: Visibility of global smarty variables
Post a bug report in the Forge
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
Migrating Company Directory module to LISE
- + - + - + - + - + - + -