【发布时间】:2015-01-08 18:40:16
【问题描述】:
我很抱歉这个愚蠢的问题,但我不明白!
我想构建一个简单的网站前端,例如这个带有 Mustache 的示例: http://detector.dmolsen.com/demo/mustache/
如果我的网站只有一页 - 一切都很好: 我创建了我的 Mustache 对象......等等
// use .html instead of .mustache for default template extension
$options = array('extension' => '.html');
// Template and Partial - Filesystem Loader
$mustache = new Mustache_Engine(array(
'loader' => new Mustache_Loader_FilesystemLoader(__DIR__.'/views', $options),
'partials_loader' => new Mustache_Loader_FilesystemLoader(__DIR__.'/views/partials/'.$GLOBALS['comparedDeviceInformation']['Device Class'], $options),
));
在此之后我渲染我的索引模板:
// render index.html template
echo $mustache->render('index', $data);
这工作得很好! 现在在这个“index.html”模板文件中,我不想链接到另一个模板,例如主页.html
<a href="?????">home</a>
我如何处理 URL?我不能使用模板的名称?那么如何为我的网站获得一致的 URL 结构
非常感谢!
【问题讨论】:
标签: php mustache mustache.php