Skip to content

原始内容 rawContent ​

视图中直接输出的 HTML(包括 echo 的内容)可以放到 Zin 节点树的指定位置。rawContent() 插入未命名内容,rawContent($name) 插入对应的命名片段。

在指定位置输出 ​

php
<?php
namespace zin;

panel(set::title('说明'), rawContent());
?>
<p>可在此查看项目记录。</p>

完整页面、模态对话框与片段渲染时,会在上下文尚未放置未命名内容时自动插入。显式调用 rawContent() 后,就使用该调用所在的位置。参见 page、modalDialog 和 fragment。

命名片段 ​

标记名使用字母、数字或下划线。同一视图可以同时放置未命名内容和不同的命名片段。用 rawContentStart($name) 和 rawContentEnd($name) 标记片段边界。

php
<?php
namespace zin;

panel(set::title('工作摘要'), rawContent('summary'));
to::footer(rawContent('footer'));
?>
<?php rawContentStart('summary'); ?>
<p>本周完成三个里程碑。</p>
<?php rawContentEnd('summary'); ?>
<?php rawContentStart('footer'); ?>
<small>统计截止到周五。</small>
<?php rawContentEnd('footer'); ?>