我遵循了Video store和Jobet示例,并尝试在./admin子目录中创建一个Administrator界面。但是,我想使用模板,但我不确定是否需要创建一个新的模板目录,即./admin/ template /,或者我可以使用主API使用的默认模板,即./ template / default /?
以下是网站的控制流程:
1) /admin/index.php <-实例化/admin/lib/AdminFrontend
2) / admin /lib/AdminFrontend <-隐式调用/admin/page/index.php进行admin登录。
在/admin/ page /index.php中,它设置一个登录页面并调用defaultTemplate()函数:
function defaultTemplate(){
return array('page/login');
}然而,我得到一个错误"Spot is not found in owner's template“。
我曾尝试使用AdminFrontend中的addlocation()函数添加根模板(.template/default/),但无法正常工作。
$this->addLocation('../', array( 'template' => array('templates'),
'php' => 'lib' )
)->setParent($this->pathfinder->base_location);所以没有找到登录模板,但我不确定atk在哪里查找该模板,也不知道如何更改它。
从Roman的帖子来看,似乎任何新的API,例如admin,出于安全原因都需要一个新的模板目录,因此没有页面/模板在普通用户和管理员界面之间共享。
in ATK4 Can I define a different template from frontend to back end?
谢谢你的建议。
发布于 2012-08-09 21:31:20
不确定,但我认为您可能想要将子目录'admin‘作为第一个参数添加到addLocation中,如下所示
$this->addLocation('admin',array(
'page'=>array(
'page',
),
'template'=>array(
'templates',
),
))
->setParent($this->pathfinder->base_location);然后,它应该将/admin/template添加到搜索模板的路径中,并将/admin/page添加到它搜索的页面路径中。
您也可以将atk4文件夹重新安装到一个仅供管理员使用的不同atkroot下。
https://stackoverflow.com/questions/11822074
复制相似问题