Kod
function smarty_function_grid($Fileds, $visFileds) {
//treść funkcji
}
//treść funkcji
}
Wywołałem ją w szablonie w następujący sposób:
Kod
{grid Fileds="$Fileds" visFileds="$visFileds"}
Plik php z jej wywołaniem wygląda następująco:
Kod
$smarty->assign('Fileds', $records);//pola w bazie
$smarty->assign('visFileds', array('Nr' => 'Nr', 'nazwisko' => 'Nazwisko', 'imie' => 'Imię', 'telefon' => 'Telefon', 'e-mail' => 'E-mail', 'adres' => 'Adres'));
$smarty->display('grid.tpl');
$smarty->assign('visFileds', array('Nr' => 'Nr', 'nazwisko' => 'Nazwisko', 'imie' => 'Imię', 'telefon' => 'Telefon', 'e-mail' => 'E-mail', 'adres' => 'Adres'));
$smarty->display('grid.tpl');
Gdy chcę uruchomić tę funkcję w przeglądarce widzę taki komunikat:
Kod
[b]Warning[/b]: Missing argument 1 for smarty_function_grid(), called in /home/szymon/public_html/smartydirs/templates_c/%%FF^FF9^FF9C74D2%%grid.tpl.php on line 10 and defined in [b]/home/szymon/public_html/libs/Smarty/plugins/function.grid.php[/b] on line [b]25[/b]
[b]Warning[/b]: Missing argument 2 for smarty_function_grid(), called in /home/szymon/public_html/smartydirs/templates_c/%%FF^FF9^FF9C74D2%%grid.tpl.php on line 10 and defined in [b]/home/szymon/public_html/libs/Smarty/plugins/function.grid.php[/b] on line [b]25[/b]
[b]Fatal error[/b]: Cannot use object of type SmartyC as array in [b]/home/szymon/public_html/libs/Smarty/plugins/function.grid.php[/b] on line [b]30[/b]
Czy ktoś wie gdzie popełniam błąd?