PHP fast template technology

xiaoxiao2021-03-06  102

Below is just a little sample, the link below the link download package source code

Http://home.nuc.edu.cn/~arcow/display.php?id=108

/ **********************************************

********* Rushing the star ************************************

*********Arcow@126.com****************

******** http://www.fashionme.net*******

*********************************************** /

/ / This page is displayed directly

// Treat value for modulus

$ Title = "This is the title";

$ author = "This is the author";

$ Content = "This is the content";

$ TIMES = DATE ("Yend Month D Day");

// Turn into the template program module

Include ("Template.inc");

// Create a template instance MyTemp

$ myTemp = new template ("."); // here. For the template file current directory, if the template file is filled in the template directory

/ / Set the MyFileHandle file handle point to the template file Template.html we want to call

$ myTemp-> set_file ("myfilehandle", "template.html");

// Call the template's set_var method, set the variable Title value in the template to $ title, author of $ author, etc.

$ myTemp-> set_var ("Title", $ TITLE);

$ myTemp-> set_var ("author", $ author);

$ myTemp-> set_var ("Times", $ TIMES);

$ myTemp-> set_var ("Content", $ Content);

// Call the template's PARSE method, analyze the template file points to the MyFileHandle file handle, replace the corresponding variable

/ / And save the replacement result, the complete HTML file content is saved in the string variable myoutput

$ myTemp-> Parse ("myoutput", "myfilehandle");

// Print the output result string variable myoutput value, direct output

$ mytemp-> p ("myoutput");

?>

转载请注明原文地址:https://www.9cbs.com/read-105449.html

New Post(0)