From: K. O. <on...@xo...> - 2003-06-06 03:23:09
|
Hi, Looks good.. I will merge these on CVS. Thanks and regards, K. Ono ----- Original Message ----- From: "Martin Kutschker" <Mar...@bl...> To: <xoo...@li...> Sent: Friday, June 06, 2003 12:51 AM Subject: [Xoops-development] ideas for XoopsObject > <p>More convenience...</p> > > <pre> > class XoopsObject { > > ... > > var $tplVars = array(); > > ... > > /** > * Set variable names for Smarty template assignation (see assignTpl) > * > * Note: should be set in the constructor of the class > * > * @param mixed $vars array of variable names > */ > function setTplVars(&$vars) { > foreach ($vars as $var) { > $this->tplVars[] = $var; > } > } > > /** > * Assign variables to Smarty template in a batch(see setTplVars) > * > * @param object &$tpl reference to a {@link Smarty} object > * @see Smarty > */ > function assignTpl(&$tpl) { > foreach ($this->tplVars as $var) { > $tpl->assign($var, $this->getVar($var)); > } > } > > /** > * Assign values to multiple variables in a batch > * > * Meant for a CGI contenxt: > * - prefixed CGI args are considered save > * - avoids polluting of namespace with CGI args > * > * Note: 'xo' stands for 'XOOPS object', it's shorter than eg 'xoops_' :-) > * > * @access private > * @param array $var_arr associative array of values to assign > * @param string $pref prefix (only keys starting with the prefix will be set) > */ > function setFormVars($var_arr=null, $pref='xo_', $not_gpc=false) { > $len = strlen($pref); > foreach ($var_arr as $key => $value) { > if ($pref == substr($key,0,$len)) { > $this->setVar(substr($key,$len), $value, $not_gpc); > } > } > } > } > </pre> > > > ------------------------------------------------------- > This SF.net email is sponsored by: Etnus, makers of TotalView, The best > thread debugger on the planet. Designed with thread debugging features > you've never dreamed of, try TotalView 6 free at www.etnus.com. > _______________________________________________ > Xoops-development mailing list > Xoo...@li... > https://lists.sourceforge.net/lists/listinfo/xoops-development > |