var $WIN32 = true; // Set to true if this is a WIN32 server
改好后,人人就能够尝尝他的那几个例子了。 若何?胜利了吧。嘿嘿嘿嘿~~~,地藏不会骗人人的啦。
OK,如今这个库已可以用啦,咱们筹办停止上面的进修吧,:)
若何利用这个库?复杂哟,起首要把这个库包括出去。也就是说呢,要 include "class.FastTemplate.php3"; 然后?呵呵…… 然后我也不晓得啦!(编纂:"嘿!找扁啊,你!")啊,啊…!Sorry,我想起来了(在地藏被众编纂海扁一顿以后)。然后是进修这个库的利用道理。在这里呢咱们先做个假定。
In the regular version, the template named ``main'' is loaded if it hasn't been already, all the variables are interpolated, and the result is then stored in FastTemplate as the value MAIN. If the variable '{MAIN}' shows up in a later template, it will be interpolated to be the value of the parsed ``main'' template. This allows you to easily nest templates, which brings us to the compound style.
The compound style is designed to make it easier to nest templates.
The following are equivalent:
$tpl- >parse(MAIN, "table");
$tpl- >parse(MAIN, ".main");
// is the same as:
$tpl- >parse(MAIN, array("table", "main"));
// this form saves function calls and makes your code cleaner
It is important to note that when you are using the compound form, each template after the first, must contain the variable that you are parsing the results into. In the above example, 'main' must contain the variable '{MAIN}', as that is where the parsed results of 'table' is stored. If 'main' does not contain the variable '{MAIN}' then the parsed results of 'table' will be lost. The append style allows you to append the parsed results to the target variable. Placing a leading dot . before a defined file handle tells FastTemplate to append the parsed results of this template to the returned results. This is most useful when building tables that have an dynamic number of rows - such as data from a database query. )