in ATK4 Can I define a different template from fro

2019-08-06 12:28发布

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条回答
来,给爷笑一个
2楼-- · 2019-08-06 12:46

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.

查看更多
登录 后发表回答