在 ATK4 中,我可以从前端到后端定义不同的模板吗? [英] in ATK4 Can I define a different template from frontend to back end?

查看:22
本文介绍了在 ATK4 中,我可以从前端到后端定义不同的模板吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,我想对管理区域和 CRUD 使用 jUI 模板,对于前端和页面,我想使用 Elephant 主题(或我的超级秘密自定义主题).如果是这样,我该如何定义这一点.我为每个区域创建一个单独的 API?这是在我的 index.php 的根目录中.我想修改共享模板并保留旧模板.我想我应该在 root/atk4/templates/MyNewTemplate 中使用新的 jUI 主题 + css + 图像创建一个新目录并在 root/atk4/templates/shared 中创建一个新目录,或者是在页面类中定义的主应用程序?

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

推荐答案

根据定义,您的管理和前端是不同的 Web 应用程序,它们应该拥有不同的 API 类.此外,它们应该位于不同的 URL 上,因此入口点对它们来说是不同的.frontend/index.php 的内容将包含:

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');

同时用于 admin/index.php

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:

  • 为两个 API 类定义共同的祖先.(Admin 类扩展 MyApp,Frontend 类扩展 MyApp)
  • 使用相同的控制器,尤其是当您需要进行一些计算时.例如,如果您正在实施 Payroll Web App,您可能希望在这两个 API 中都有 $this->payroll=$this->add('Controller_Payroll').
  • 模型必须共享.因为您正在访问相同的数据库.您需要做的就是将前端的lib"文件夹作为 PHP 资源包含到您的管理员中.

不得共享页面,您不想混淆页面.

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

这篇关于在 ATK4 中,我可以从前端到后端定义不同的模板吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆