block.php
来自「视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.」· PHP 代码 · 共 54 行
PHP
54 行
<?phpinclude_once 'HTML/Template/PHPLIB.php';include_once 'Benchmark/Timer.php';$articles = array( "ISBN345624345" => "Matrix 2", "ISBN45df32342" => "Roger Rabbit", "ISBN305632232" => "foo bar", "ISBN674589123" => "Joe user's adventures");class myT extends Template_PHPLIB { var $file_fallbacks = array("/usr/local/bla","./");}$t =& new myT("/usr/local", "keep");$timer =& new Benchmark_Timer();$timer->start();$t->setFile(array( "main" => "tpl1.ihtml", "block" => "block.ihtml"));$t->setBlock("block","articlerow","ar");$t->setVar(array( "TITLE" => "This is a block integrated into another template", "BGCOLOR" => "#cccccc", "BLOCKER" => "block"));foreach ($articles as $isbn => $name) { $t->setVar(array( "ID" => $isbn, "ANAME" => $name )); /** * easy to use rule of thumb: first parameter is the last * from setBlock, second is the second from setBlock, third * is TRUE in order to append the parsed data to the template var * articlerow */ $t->parse("ar", "articlerow", TRUE);}$t->parse("CONTENT", "block");$t->pparse("out",array("main"));$timer->stop();$timer->display();?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?