@@ -410,7 +412,7 @@
}
if($end)
{
- $newParent .= "{$MacroName}
";
+ $newParent .= '{'."$MacroName}
";
}
// Next line please
if($end) { $end = false; }
大家用文本编辑器打开class.FastTemplate.php3文件,找到上面的部分。'-'减号代表消除这行,'+'加号代表加入这行。另外windows系统下的朋友注意哟!你们还需要改点小东西,把下面的那个$win32变量的值改成true,不改的话,用不了可别骂我,;)。
var $WIN32 = true; // Set to true if this is a WIN32 server
改好后,大家就可以试试他的那几个例子了。 如何?成功了吧。嘿嘿嘿嘿~~~,地藏不会骗大家的啦。
OK,现在这个库已经可以用啦,我们准备进行下面的学习吧,:)
如何使用这个库?简单哟,首先要把这个库包含进来。也就是说呢,要 include "class.FastTemplate.php3"; 然后?呵呵…… 然后我也不知道啦!(编辑:"嘿!找扁啊,你!")啊,啊…!Sorry,我想起来了(在地藏被众编辑海扁一顿之后)。然后是学习这个库的使用原理。在这里呢我们先做个假设。
我们假设一个页面是由很多的小的部分组成(比如:每个网站都有分栏目导航等等),而且每个小的部分都有一个唯一的标识符(比如:我们把分栏每个小项定义为一个名字)
我们首先以这个库自带的example_1为例,让大家可以尽快的学会这个库的基本用法,;),不过大家要注意哟,这几个文件在服务器上的位置要按解压时的相对路径来存,千万不要忘记,就象不要忘记你女朋友的生日一样。呵呵~~~~
< ?
// Example FastTemplate Demo #1 - The example from the man page
Header("Content-type: text/plain");
include("class.FastTemplate.php3");
$tpl = new FastTemplate("./templates");
$tpl- >define(
array(
main = > "main.tpl",
table = > "table.tpl",
row = > "row.tpl"
)
);
$tpl- >assign( array( TITLE = > "FastTemplate Test") );
for ($n=1; $n < = 3; $n++)
{
$Number = $n;
$BigNum = $n*10;
$tpl- >assign(
array(
NUMBER = > $Number,
BIG_NUMBER = > $BigNum
)
);
$tpl- >parse(ROWS,".row");
}
$tpl- >parse(MAIN, array("table","main"));
$tpl- >FastPrint();
exit;
? >
< !-- NAME: main.tpl -- >
< html >
< head >< title > {TITLE} < /title >
< /head >
< body >
{MAIN}
< /body >
< /html >
< !-- END: main.tpl -- >
< !-- NAME: table.tpl -- >
< table border='1' >
{ROWS}
&n
}
if($end)
{
- $newParent .= "{$MacroName}
";
+ $newParent .= '{'."$MacroName}
";
}
// Next line please
if($end) { $end = false; }
大家用文本编辑器打开class.FastTemplate.php3文件,找到上面的部分。'-'减号代表消除这行,'+'加号代表加入这行。另外windows系统下的朋友注意哟!你们还需要改点小东西,把下面的那个$win32变量的值改成true,不改的话,用不了可别骂我,;)。
var $WIN32 = true; // Set to true if this is a WIN32 server
改好后,大家就可以试试他的那几个例子了。 如何?成功了吧。嘿嘿嘿嘿~~~,地藏不会骗大家的啦。
OK,现在这个库已经可以用啦,我们准备进行下面的学习吧,:)
如何使用这个库?简单哟,首先要把这个库包含进来。也就是说呢,要 include "class.FastTemplate.php3"; 然后?呵呵…… 然后我也不知道啦!(编辑:"嘿!找扁啊,你!")啊,啊…!Sorry,我想起来了(在地藏被众编辑海扁一顿之后)。然后是学习这个库的使用原理。在这里呢我们先做个假设。
我们假设一个页面是由很多的小的部分组成(比如:每个网站都有分栏目导航等等),而且每个小的部分都有一个唯一的标识符(比如:我们把分栏每个小项定义为一个名字)
我们首先以这个库自带的example_1为例,让大家可以尽快的学会这个库的基本用法,;),不过大家要注意哟,这几个文件在服务器上的位置要按解压时的相对路径来存,千万不要忘记,就象不要忘记你女朋友的生日一样。呵呵~~~~
< ?
// Example FastTemplate Demo #1 - The example from the man page
Header("Content-type: text/plain");
include("class.FastTemplate.php3");
$tpl = new FastTemplate("./templates");
$tpl- >define(
array(
main = > "main.tpl",
table = > "table.tpl",
row = > "row.tpl"
)
);
$tpl- >assign( array( TITLE = > "FastTemplate Test") );
for ($n=1; $n < = 3; $n++)
{
$Number = $n;
$BigNum = $n*10;
$tpl- >assign(
array(
NUMBER = > $Number,
BIG_NUMBER = > $BigNum
)
);
$tpl- >parse(ROWS,".row");
}
$tpl- >parse(MAIN, array("table","main"));
$tpl- >FastPrint();
exit;
? >
< !-- NAME: main.tpl -- >
< html >
< head >< title > {TITLE} < /title >
< /head >
< body >
{MAIN}
< /body >
< /html >
< !-- END: main.tpl -- >
< !-- NAME: table.tpl -- >
< table border='1' >
{ROWS}
&n
| 对此文章发表了评论 |
