When developing a website using the MVC method, I want to use the phplib template class to process all templates. I want to find a C # template source code on the Internet, finally, I found the source code of the VBScript version. On this basis, I translated it into the C # version. after trial, the effect and performance are fairly good. It is suitable for the MVC development and use of Small and Medium websites and is not exclusive, submitted for your reference.
Click here to download. The usage and function interfaces are compatible with phplib.
String toptemplatevar = "login ";
String currentmodule = "security ";
Template T;
T = new template ();
T. set_root ("~ /Templates/common ");
T. set_file ("simplepage", "simplepage. ihtml ");
T. set_file ("mainmenu", "mainmenu. ihtml ");
T. set_file ("pageheader", "head. ihtml ");
T. set_file ("pagefooter", "tail. ihtml ");
T. set_file (toptemplatevar, "login. ihtml ");
T. set_var ("title", sitecache. getmultilanguagestring (page_title ));
T. set_block ("pageheader", "topmenu1", "topmenu1s ");
.
.
.
T. parse ("pagebodyer", toptemplatevar );
T. Unknown = "Remove ";
Httpcontext. Current. response. Write (T. Finish (T. SUBST ("simplepage ")));
T = NULL;