Your Open Source
Free YourOpenSource Softwares Online Resources and Softwares Downloads with Demo
Related Links
Smarty
Creating Custom function or tag in Smarty templates
Smarty in-build a lot of function to customize the pages that we want.. the following ways to we can make a new custom function or tags,
Step 1 :-
Need to write the php function in the smarty plug-ins directory,
function smarty_function_sitehost($params, &$smarty){
if(!isset($params['key'])) {
$smarty->trigger_error("Invalid ID");
return;
}
return $_SERVER["HTTP_HOST"];
}
need to save the files like this style function.sitehost.php and stored in plugins directory.
Step 2:-
In smarty template files, name is home.tpl
{sitehost key='ghost'} This is normal smarty templates files, so can call the sitehost smarty tag whenever needed.
That's it.
95
Jul 03 09 06:31:44
Sekar
Rating : 









|
|||
Digg
Yahoo
delicious