-1
In this project I’m having trouble finding the route /admin I created, accessing the site index('/') the route that was set works normally, however access the admin index('/admin') the file is not found. Code: Page index
<?php
require_once("vendor/autoload.php");
use \Slim\Slim;
use \Hcode\Page;
use \Hcode\PageAdmin;
$app = new Slim();
$app->config('debug', true);
$app->get('/', function() {
$page = new Page();
$page->setTpl("index");
});
$app->get('/admin', function() {
$page = new PageAdmin();
$page->setTpl("index");
});
$app->run();
?>
Page class (provides template to index):
<?php
namespace Hcode;
use Rain\Tpl;
class Page {
private $tpl;
private $options = [];
private $defaults = [
"header"=>true,
"footer"=>true,
"data"=>[]
];
public function __construct($opts = array(), $tpl_dir = "/views/")
{
$this->options = array_merge($this->defaults, $opts);
...
Pageadmin class (provides template to page /admin):
<?php
namespace Hcode;
class PageAdmin extends Page{
public function __construct($opts = array(), $tpl_dir = "/views/admin/"){
parent::__construct($opts, $tpl_dir);
}
}
I was able to access the Page and Pageadmin class by the index('/') route, however, by the admin('/admin') route the following object error not found Error 404 is returned.
I haven’t solved it yet, I haven’t even continued this project because of this problem, but in the future I’ll try to solve it, if I can put it here. Hug!
– Leo Lima