1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
|
<?php
// Template System Function(s)
function gettemplate($template,$fileformat="tpl")
{
return str_replace("\"","\\\"",implode("",file("path/to/templates/folder/".$template.".".$fileformat)));
}
# How to use: eval ("\$sub_template .= \"".gettemplate("sub_template")."\";");
## You can change $sub_template into your desired variable name, independent from the template (file) name
### You can call variables (defined before loading the tpl) in the tpl file
#### You need to replace "path/to/templates/folder/" with the actual path to YOUR templates folder
##### The $fileformat="tpl" means that your template files need to use the .tpl file extension.
##### Example: template_name.tpl You can change it of course.
function display($template) {
echo $template;
}
# How to use: eval ("display(\"".gettemplate("main_template")."\");");
## You can call variables (defined before loading the tpl) in the tpl file
//How to use
eval ("\$sub_template .= \"".gettemplate("sub_template")."\";");
eval ("display(\"".gettemplate("main_template")."\");");
# You can load "sub templates" in a "main template" by simply placing the variable name of the
# "sub template" into the main template file.
?>
|