发新话题
打印

HTML_Template_Flexy学习笔记(三)

HTML_Template_Flexy学习笔记(三)

复制内容到剪贴板
代码:
$flexy->outputObject()

void $flexy-> outputObject (object $controllerObject [, array $elements])
精髓:$controllerObject 的所有成员变量的值会赋给template中同名{tag},而数组$elements的所有元素的值将赋予template的form中同名的元素。

controller class example:
复制内容到剪贴板
代码:
class example {
  var $tag = ">> hello world";
}

$data = new example;

$elements['test'] = new HTML_Template_Flexy_Element;
$elements['test']->setValue("hello input");

$output = new HTML_Template_Flexy();
$output->compile("hello.html");
$output->outputObject($data,$elements);
template example:
复制内容到剪贴板
代码:
<B>{tag}</B>
<B>{tag:h}</B>
<INPUT name="test">
输出结果:
引用:
<B>&gt;&gt; hello world</B>
<B>>> hello world</B>
<INPUT name="test" value="hello input">
专注于DEDE采集和数据深度挖掘

TOP

发新话题