{if condition="empty($projects)"}
{else/}
{if condition="empty($tree)"}
当前版本下还没有文档,点击右上角「新增文档」或「导入文档」开始创建
{else/}
{php}
/**
* 递归渲染文档目录树
* 模板引擎不支持递归 include,这里用函数递归输出
*/
if (!function_exists('docs_render_tree')) {
function docs_render_tree(array $nodes)
{
foreach ($nodes as $node) {
$id = (int) $node['id'];
$pid = (int) $node['pid'];
$sort = (int) $node['sort'];
$isDir = (int) $node['is_dir'] === 1;
$title = htmlspecialchars((string) $node['title'], ENT_QUOTES, 'UTF-8');
$name = htmlspecialchars((string) $node['name'], ENT_QUOTES, 'UTF-8');
echo '- ';
echo '
';
echo '
';
echo '
';
echo '';
echo $title . ' ' . $name . '';
if ($isDir) {
echo '目录';
}
if ((int) $node['status'] !== 1) {
echo '隐藏';
}
echo '';
echo '
';
echo '编辑';
echo '加子级';
echo '删除';
echo '';
echo '
';
if (!empty($node['children'])) {
echo '';
docs_render_tree($node['children']);
echo '
';
}
echo ' ';
}
}
}
docs_render_tree($tree);
{/php}
{/if}
{/if}