所以,我的传统方法是使用模板解析器类而不是标准的视图加载方法。唯一的问题是,如果使用了多个变量,变量可能会在一段时间后开始变得混乱category
。
例如......这样的数组:
$data = array(
'THREAD' => array(
'TITLE' => "Some Cool Title",
'MESSAGE' => "Hello, world!",
'AUTHOR' => $author_info //Some Array of author's info
),
'COMMENT_RESULTS' => array(
array(
'MESSAGE' => "hello, world!",
'AUTHOR' => array()
)
)
);
看法:
<h1>{THREAD:TITLE}</h1>
<H2>Posted by {THREAD:AUTHOR:USERNAME}
<p>{THREAD:MESSAGE}</p>
<ul>{COMMENT_RESULTS}
<li>
{COMMENT:MESSAGE}
Posted by {COMMENT:AUTHOR:USERNAME}
</li>
</ul>