Welcome Guest, Not a member yet? Register   Sign In
Custom CMS and (:any) Route Predicament
#1

[eluser]Vheissu[/eluser]
My CMS is nearing completion (functionality wise) and although it currently works I have a few issues.

My setup:

* Codeigniter 2.0 (latest version)
* Modular Extensions (latest version)
* PHP 5.3.0

I have a module called pages with a pages controller that contains a _remap remap function and in my routes.php I have the following code:

Code:
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

// All default requests go to pages
$route['default_controller']   = "pages";    // Pages controller is the default controller

// Login link
$route['login']                = "auth";
$route['logout']               = "auth/logout";

// Admin control panel
$route['admin']                = "admin";

// Individual module admin controllers
$route['(:any)/admin']         = "$1/admin";

// Every request to the pages controller
$route['(:any)']               = "pages";


/* End of file routes.php */
/* Location: ./application/config/routes.php */
My issue is that although accessing pages like; /about-us or /home works quite fine, I've noticed that the (:any) routing rule is stopping direct access to actual controllers and modules.

So if I have an auth module and go /auth/login - I find that the (:any) is routing this to my pages controller _remap function and not actually calling the module controller, this also seems to be the case for controllers in the root application controllers directory, is there a better way?

I tried using 404_override in my routes file instead of (:any) but it didn't seem to work. Is there a way to check if a controller / module exists first before loading up a page? And also, how would I handle pages with the same name as modules and controllers in my application?

Appending /page/page-name to the URL would probably be a fix, but I want them to just be /page-name instead.


Messages In This Thread
Custom CMS and (:any) Route Predicament - by El Forum - 10-25-2010, 11:48 PM
Custom CMS and (:any) Route Predicament - by El Forum - 10-25-2010, 11:58 PM
Custom CMS and (:any) Route Predicament - by El Forum - 10-26-2010, 12:00 AM
Custom CMS and (:any) Route Predicament - by El Forum - 10-26-2010, 05:05 AM



Theme © iAndrew 2016 - Forum software by © MyBB