I want to do something like:
class Name{
function assign($name,$value){
}
}
Which is pretty much the same as assign
in smarty:
$smarty->assign('name',$value);
$smarty->display("index.html");
How do I implement this?
I want to do something like:
class Name{
function assign($name,$value){
}
}
Which is pretty much the same as assign
in smarty:
$smarty->assign('name',$value);
$smarty->display("index.html");
How do I implement this?
You should create a global registry class to make your variables available to your HTML file:
And access like this from your files:
The
extract()
call temporarily pulls key-value pairs from an array into existence as variables named for each key with values corresponding to the array values.The question's a little vague. If you want to keep the $value of $name around for future use you could do something like:
Then to make the variables available in an included template file:
And if path/to/file.tpl contains:
You would get output like this
I would say