I've followed the Video store and Jobet examples, and I'm trying to create an Administrator interface in the ./admin subdirectory. However, I want to use templates and I'm not sure if I need to create a new template directory, i.e. ./admin/templates/ or I can use the default template, i.e. ./templates/default/ which is used by the main API ?
Below is the flow of control of the website:
1) /admin/index.php <- instantiates /admin/lib/AdminFrontend
2) /admin/lib/AdminFrontend <- calls /admin/page/index.php (implicitly) for login of admin.
Inside /admin/page/index.php it sets up a login page and calls the defaultTemplate() function:
function defaultTemplate(){
return array('page/login');
}
However, I get an error "Spot is not found in owner's template".
I've tried to use the addlocation() function inside AdminFrontend to add root template (.template/default/), but I cannot get it to work.
$this->addLocation('../', array( 'template' => array('templates'),
'php' => 'lib' )
)->setParent($this->pathfinder->base_location);
So the login template is not found, but I'm not sure where atk is looking for the template or how I can change it.
From Roman's post, it seems that any new API's, e.g. admin, need a new template directory for security reasons so no pages/templates are shared between the normal users and admin interfaces.
in ATK4 Can I define a different template from frontend to back end?
Thanks for your advice.