RE: problem passing variables

From: Date: Thu, 10 May 2001 10:04:38 +0000
Subject: RE: problem passing variables
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-713@lists.php.net to get a copy of this message
Hi You should follow one of the other functions - ie they are setup like this: function smarty_func_translate() { extract(func_get_arg(0)); // get passed variables include("../stphp/code/st/st.php"); global $LocalePath, $LocaleMechanism; $LocalePath = $locPath; $LocaleMechanism = $locMech; eval (ST ($strId, "\$toStr", $locLang)); echo $toStr; } - brian > -----Original Message----- > From: Tomas Sanchez Romani [mailto:tomas@altern.org] > Sent: Thursday, 10 May 2001 21:23 > To: Smarty List > Subject: [smarty] problem passing variables > > > Hi, I'm having trouble with passing variables to a custom function I'm > trying to do. > > ---the function: > > /*============================================*\ > Function: smarty_func_translate > Purpose: translate the string ($strId) with STPhp > \*============================================*/ > > function smarty_func_translate($strId, $toStr, $locLang, > $locPath, $locMech) > { > include("../stphp/code/st/st.php"); > global $LocalePath, $LocaleMechanism; > $LocalePath = $locPath; > $LocaleMechanism = $locMech; > eval (ST ($strId, "\$toStr", $locLang)); > echo $toStr; > } > > ---the call from within the tamplate: > > {translate locLang=$locLang locPath=$locPath locMech=$locMech strId=$strId > toStr=$toStr} > > ---the assigning from the script: > > $smarty->assign("locLang", $locLang); > $smarty->assign("locMech", $locMech); > $smarty->assign("toStr", $toStr); > $smarty->assign("strId", $strId); > $smarty->assign("locPath", $locPath); > > ---the result: > > Warning: Missing argument 3 for smarty_func_translate() > in Smarty.addons.php on line 45 > > Warning: Missing argument 4 for smarty_func_translate() > in Smarty.addons.php on line 45 > > Warning: Missing argument 5 for smarty_func_translate() > in Smarty.addons.php on line 45 > > ---the question: > > what's wrong? > > please help, a&l, tomas > > > --- > You are currently subscribed to smarty as: brian@informate.co.nz > To unsubscribe send a blank email to $subst('Email.Unsub') > Visit Smarty's homepage at «�Ñ > ÍpÜòÞ;s>¯²*ßhttp://www.phpinsider.com/php/code/Smarty/ >

« previous php.smarty.general (#713) next »