doujiu3097 2011-09-13 19:33
浏览 32
已采纳

在ATK4中我可以定义从前端到后端的不同模板吗?

For Example, I would like to use the jUI template for the Admin area and CRUD, and for the FrontEnd and Pages I'd like to use the Elephant theme (or my super secret custom one). If so How do I go about defining this. I create a separate API for each area? this is in my index.php in the Root. And I'd like to mod the Shared template and keep the old one as well. I think I am supposed to create a new Dir in root/atk4/templates/MyNewTemplate with the new jUI theme + css + images And create a new Dir in the root/atk4/templates/shared or is that defined in the page class of the main app?

include 'atk4/loader.php';
$api=new Frontend('sample_project','elephant');
$api->main();

http://agiletoolkit.org

  • 写回答

1条回答 默认 最新

  • dongxia8656 2011-09-13 19:52
    关注

    By definition, your administration and your frontend are DIFFERENT web application and they deserve to have a different API class. Also they should be located on different URLs so the entry-point would be different for them. the content of frontend/index.php would contain:

    $api=new Frontend('MyFrontend','elephant');
    

    while for the admin/index.php

    $api=new Admin('MyAdmin');
    

    By having separate applications like that you also making sure that authentication for the front-end will not allow users to access administration area.

    While Admin classes are different, it's perfectly normal to:

    • Define common ancestor for both API classes. (class Admin extends MyApp and class Frontend extends MyApp)
    • Use same controller, especially if you need to do some calculation. For example if you are implementing Payroll Web App, you might want to have $this->payroll=$this->add('Controller_Payroll') in both of the APIs.
    • Models simply MUST be shared. Because you are accessing same database. All you need to do is to include frontend's "lib" folder as PHP resource into your admin.

    Pages must not be shared, you don't want to mix pages up.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 echarts动画效果失效的问题。官网下载的例子。
  • ¥60 许可证msc licensing软件报错显示已有相同版本软件,但是下一步显示无法读取日志目录。
  • ¥15 Attention is all you need 的代码运行
  • ¥15 一个服务器已经有一个系统了如果用usb再装一个系统,原来的系统会被覆盖掉吗
  • ¥15 使用esm_msa1_t12_100M_UR50S蛋白质语言模型进行零样本预测时,终端显示出了sequence handled的进度条,但是并不出结果就自动终止回到命令提示行了是怎么回事:
  • ¥15 前置放大电路与功率放大电路相连放大倍数出现问题
  • ¥30 关于<main>标签页面跳转的问题
  • ¥80 部署运行web自动化项目
  • ¥15 腾讯云如何建立同一个项目中物模型之间的联系
  • ¥30 VMware 云桌面水印如何添加