jsmonzani trick for multilingual

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
nimo66
New Member
New Member
Posts: 4
Joined: Mon Apr 25, 2016 4:02 pm

jsmonzani trick for multilingual

Post by nimo66 »

Hello,
I tried to update trick jsmonzani for CMS 2.1.2:
http://forum.cmsmadesimple.org/viewtopic.php?t=11756

Unfortunately without success. someone has a track for me?

Code: Select all

$gCms = cmsms();
$smarty = $template->smarty;

	$manager =& $gCms->GetHierarchyManager();
	$thisPage = $gCms->variables['content_id'];
	$thisPage = intval($params['pageid']);
	$currentNode =& $manager->sureGetNodeById($thisPage);
	$currentContent =& $currentNode->getContent();
	
	if ($smarty->get_template_vars('weblang') == "fr") {
	$t_ =$currentContent->MenuText();
	} else {
	$t_ =$currentContent->GetPropertyValue('menu_' . $smarty->get_template_vars('weblang')); 

	}

	$smarty->assign('current_menu_text', $t_);
Thanks in advance
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: jsmonzani trick for multilingual

Post by Rolf »

- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
nimo66
New Member
New Member
Posts: 4
Joined: Mon Apr 25, 2016 4:02 pm

Re: jsmonzani trick for multilingual

Post by nimo66 »

Thanks Rolf,
I tried as well, but my variable "$ current text menu" return empty :(

Code: Select all

function smarty_function_general_menu_title($params, &$template)
{
$smarty = $template->smarty;
$manager = cmsms()->GetHierarchyManager();

$thisPage = isset($params['pageid']) ? $params['pageid'] : cmsms()->variables['content_id'];

$currentNode = &$manager->sureGetNodeById($thisPage);
$currentContent =& $currentNode->getContent();

if ($smarty->get_template_vars('weblang') == "fr") {
	$t_ =$currentContent->MenuText();
	} else {
	$t_ =$currentContent->GetPropertyValue('menu_' . $smarty->get_template_vars('weblang')); 
	}
	$smarty->assign('current_menu_text', $t_);
}
nimo66
New Member
New Member
Posts: 4
Joined: Mon Apr 25, 2016 4:02 pm

Re: jsmonzani trick for multilingual

Post by nimo66 »

I noticed that

Code: Select all

$smarty->get_template_vars('weblang')
not working. It no return value... any idea?
nimo66
New Member
New Member
Posts: 4
Joined: Mon Apr 25, 2016 4:02 pm

Re: jsmonzani trick for multilingual

Post by nimo66 »

Hello,
When I add {get_template_vars} I see my variable -$weblang-, but when I want it back with -$smarty->get_template_vars( 'weblang')- I have nothing back :(
Jos
Support Guru
Support Guru
Posts: 4020
Joined: Wed Sep 05, 2007 8:03 pm

Re: jsmonzani trick for multilingual

Post by Jos »

maybe a scope issue.
you might want to read chapter 3 on this page: http://docs.cmsmadesimple.org/upgrading/to-cmsms-2.x
Post Reply

Return to “Modules/Add-Ons”