Welcome Guest, Not a member yet? Register   Sign In
Dynamic controller page name
#1

[eluser]nra[/eluser]
Hello,
I would like to know what is the best way to get and call my dynamic controller.
I will have:
application/controllers/1.php ( class MY_class)
application/controllers/2.php ( class MY_class)
...

The route will be "my-class" or diffult uri via routes.

The controller path file is comming from XML file and is different in context users.

To resume i want different to have different names between class and filename.

How can i do this simply ?

Thanks Smile
#2

[eluser]nra[/eluser]
Hi,
I am going to rewrite show_404() and set it to return nothing evoidind header already set.
After it, make a pre_system or pre_contrller hook and include my controller at this moment or in core MY_CONTROLLER;

Is it a good idea ?
#3

[eluser]nra[/eluser]
I find the solution.
i write real file with real file name in controller foller loke default_controller.pjp.
In this file i put :
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
require_once(CMS_CONTROLLER_URL);

After it, i set a hook pre_stystem:
Code:
function set_controller(){
$url = 'application/controllers/CMS/revisions/1.php';
  define('CMS_CONTROLLER_URL', $url);
}

And the controller file (1.php)
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class default_controller extends CMS_Controller
{
public function index()
{
  echo "ma_page_controller";
}
}


Work perfectly i just have now to get the good revision of the controller Smile




Theme © iAndrew 2016 - Forum software by © MyBB