(12-28-2020, 02:45 AM)demyr Wrote: Can you please paste here your home or index method in your controller ?
And also router please. If you can provide some code samples here, we will have a chance to diagnose it directly.
BELOW THE CODE OUT MY CONTROLLER - i am new to php, so i do not know which part of the code is needed...
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Class Frontend_Controller
*/
class Frontend_Controller extends MX_Controller
{
public $settings;
/**
* Frontend_Controller constructor.
*/
public function __construct()
{
parent::__construct();
$this->load->model("pages/pages_model");
$this->init();
}
public function init()
{
$this->config->set_item('base_url', '/');
$config = [
'paths' => ['./application/modules/', VIEWPATH],
];
$this->load->library('twig', $config);
// Blog instellingen ophalen
$this->load->model("blog/blogsettings_model", "blogsettings_model");
$blog_page = $this->pages_model->get($this->blogsettings_model->get()["id_page"]);
$this->settings["blog"]["page"] = $blog_page;
// Maand namen bepalen
$this->months = ["", "januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december"];
}
/**
* @param $tpl
* @param array $args
*/
public function tpl($tpl, $args = [])
{
$args["is_admin"] = $this->session->userdata("hash") ? 1 : 0;
$args["settings"] = $this->settings;
$args["base_url"] = '/';
$args['copy_date'] = date('Y');
echo $this->twig->render($tpl, $args);
}
}
/**
* Class Backend_Controller
*/
class Backend_Controller extends MX_Controller
{
/**
* Backend_Controller constructor.
*/
public function __construct()
{
parent::__construct();
$this->init();
}
/**
*
*/
public function init()
{
$this->load->model("administrators/administrators_model");
$this->config->set_item('base_url','/admin');
$this->authorised();
$config = [
'paths' => ['./application/modules/', VIEWPATH],
];
$this->load->library('twig', $config);
}
/**
* @param $tpl
* @param array $args
*/
public function tpl($tpl, $args = [])
{
$args["base_url"] = '/';
echo $this->twig->render($tpl, $args);
}
/**
*
*/
public function authorised()
{
$administrator = $this->administrators_model->get_by_hash($this->session->userdata("hash"));
if ((! $this->session->userdata("hash") && $this->uri->segment("2") != "authorised")
|| $this->session->userdata("hash") && ! $administrator["id"] && $this->uri->segment("2") != "authorised") {
redirect("authorised");
}
}
}
BELOW THE CODE OUT MY ROUTER
<?php (defined('BASEPATH')) OR exit('No direct script access allowed');
/* load the MX_Router class */
require APPPATH."third_party/MX/Router.php";
class MY_Router extends MX_Router {}