我尝试在我的视图header.html中使用递归包含:
{foreach from=$pages item=page}
<li><a href="{$page['url']}">{$page['title']}</a></li>
{if isset($page['children']) }
<ul>
{include file="file:{$resourcesUrl}/views/templates/recursive_menu.tpl" element=$page['children']}
</ul>
{/if}
{/foreach}
,模板包含:
{foreach from=($page['children'] item=child}
<li><a href="{$child['url']}">{$child['title']}</a></li>
{if $child['children']}
<ul>{include file="file{$resourcesUrl}/views/templates/recursive_menu.tpl</ul>element=$child['children']}</ul>
{/if}
{/foreach}
但我有这个错误:
未捕获的异常'SmartyException',消息'无法加载 模板文件 'http://local.codolet.fr/wp-content/themes/codolet-template/views/templates/recursive_menu.tpl'
错误表明路径不好。但是,路径是正确的(在错误消息中查看它)!我还检查了文件的权限,一切都在775。
感谢您的帮助