custom function failure
| From: | taliku at balcab dot ch | Date: | Tue, 27 Mar 2001 18:53:26 +0000 |
| Subject: | custom function failure | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-453@lists.php.net to get a copy of this message | ||
Hello everyone,
i have a little problem with creating a custom function:
I've made a function wich should create a menu:
/*======================================================================*\
Function: smarty_func_makemenu
Purpose: fetch file, web or ftp data and display results
\*======================================================================*/
function smarty_func_makemenu($menu, $qstring) {
// create array
// Count arrray
$anz = count($menu);
// create menu
for($i=0; $i<$anz; $i++){
if(eregi($menu[$i],$qstring)){
echo "<font style=\"COLOR: #ffffff\"
face=\"Verdana,Arial,Helvetica\" size=\"2\"><span
class=\"LeftNavChosen\"
buttonType=\"LeftNavChosen\">• ".ucwords(str_replace("_","
",$menu[$i]))."</span></font><br><img
src=\"assets/line.gif\" width=\"164\"
height=\"2\"><br>\n";
} else {
echo "<a href=\"?$menu[$i]\"><font style=\"COLOR:
#ffffff\"
face=\"Verdana,Arial,Helvetica\" size=\"2\"><span
class=\"LeftNavOff\"
buttonType=\"LeftNav\">".ucwords(str_replace("_","
",$menu[$i]))."</span></font></a><br><img
src=\"assets/line.gif\"
width=\"164\" height=\"2\"><br>\n";
}
}
}
The i registred it in Smarty.class.php:
'makemenu' => 'smarty_func_makemenu'
Now i call the function in my template like this:
{makemenu
menu="home_/_news","projects","downloads","gaming","my_n-theme","site_info"
qstring=$qstring}
But it dont work: i get the half-menu and following errors:
Warning: Missing argument 2 for smarty_func_makemenu() in
e:\htdocs\n-theme.com\site\smarty.add.php on line 349
Warning: REG_EMPTY:½empty (sub)expression in
e:\htdocs\n-theme.com\site\smarty.add.php on line 361
Warning: REG_EMPTY:½empty (sub)expression in
e:\htdocs\n-theme.com\site\smarty.add.php on line 361
Does anyone know the problem? what can i do?
Thanks in advance
taliku
Sorry for the bad english :)