After the Controller method finishes processing the data, it calls Tpl::ouput () and Tpl::showpage () to separate the outgoing data and invoke the page template. So record the learning tpl.php class here.
Static variables in this class:
$instance: Storing instances of this class
$output _value: Store output data
$TPL _dir: Store Default template path (folder name)
$layout _file: Store Default layout Name
The party static method in this class:
GetInstance (): Checks whether the static variable $instance is an instance, and if not, instantiates a TPL class and assigns it to the $instance
Setdir ($dir): Sets the folder where the template file is located, that is, the value of the static variable $tpl_dir
SetLayout ($layout): Sets the default layout name, which is the value of the static variable%layout_file
Output ($output, $input = "): Stores the input data into the static variable $output_value, where the parameter $output is key, $input is the value
ShowPage ($page _name= ", $layout =", $time =2000): Find the corresponding template $page_name and layout files according to the settings, and include_once ()
And a function to turn on cache Templatecachestart (), turn off Cache Templatecacheend (), and display trace information on the page showtrace ()
The output () function is used primarily in the controller to export data, use the ShowPage () function to assemble the template file path, and then include and run the template file.
SHOPNC Learning (a) tpl.php template driver