I like it just:) PHP
// QuickTPL class, used for template // lovered (gv) created on April 11, 2004
Class QuickTPL {var $ filename; // Template file var $ content; // Return content
// Initialization Template file, read all content to Function QuickTPL ($ TPLFILENAME) {$ this-> filename = $ TPLFILENAME; $ fd = fopen ($ this-> filename, "r"); $ this-> content =fread ($ FD, FileSize); fclose ($ fd);}
// Replace the logo content Function Assign ($ this-> content = str_replace ("{". $ Key. "}", $ Value, $ this-> content);}
// Replace the flag block content function blockssign ($ block_name, $ values) {// gets the sub-template IF (IS_ARRAY ($ VALUES)) {EREG ("{". $ Block_name. "}. * {/". $ block_name. "}", $ this-> Content, $ regs); $ str_block = substr ($ regs [0], 2 strlen ($ block_name), - (Strlen ($ block_name) 3); $ STR_REPLACE = "" "$ Block_replace =" ";
Foreach ($ STR_REPLACE = $ STR_BLOCK; While (list ($ key, $ val) = Each ($ SUBARR)) {$ Str_replace = STR_REPLACE ("{". $ key. "}", $ Val, $ STR_REPLACE);} $ block_replace. = $ str_replace;} $ this-> content = EREG_REPLACE ("{". $ block_name. "}. * {/". $ block_name. "}", $ block_replace, $ THIS -> Content;} else $ this-> content = EREG_REPLACE ("{". $ block_name. "}. * {/". $ block_name. "}", "none", $ this-> content);}
// Output template content Function show () {Echo $ this-> content;}}?> The following is a demanded template file XML Version = "1.0" encoding = "utf-8"?>