CodeIgniter Forums
Modular Extensions - module routing problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Modular Extensions - module routing problem (/showthread.php?tid=35789)



Modular Extensions - module routing problem - El Forum - 11-11-2010

[eluser]mreeves[/eluser]
Hi there,

Firstly a huge thank you to wiredesignz for his continued work on Modular Extensions.

I am in the process of porting an app from CI1 and modular separation over to CI2 and modular extensions. All going well except for a couple of issues. The one which I am really stumped on is an issue with routing.

I have a controller that is accessed with the url '/property/sold-prices' and a routes.php file in the config directory of the property module that directs that request to the 'Sold Prices' controller with $route['sold-prices'] = "sold_prices"; This worked fine under modular separation but does not under modular extensions. If I add the routing rule $route['property/sold-prices'] = "property/sold_prices"; to the main application routes file it works fine.

I've checked, by looking at the output of Uh Oh (another great piece of work), that the modules routes file is getting included and it is so i'm at a loos as to what is going on.

Any advice would be much appreciated.

Regards
Martin


Modular Extensions - module routing problem - El Forum - 11-11-2010

[eluser]wiredesignz[/eluser]
Try module level routing such as:
Code:
$route['property/sold-prices'] = 'sold_prices';



Modular Extensions - module routing problem - El Forum - 11-11-2010

[eluser]mreeves[/eluser]
Your a genius, cheers. Already sent you a couple of pints via the donate button.

I had already tried $route['sold-prices'] = 'sold_prices'; and $route['property/sold-prices'] = 'property/sold_prices'; but didn't consider $route['property/sold-prices'] = 'sold_prices';


Modular Extensions - module routing problem - El Forum - 11-11-2010

[eluser]wiredesignz[/eluser]
Thank you for the donation. It is appreciated.


Modular Extensions - module routing problem - El Forum - 03-31-2011

[eluser]Unknown[/eluser]
I'm not sure if this is the correct place to post this, so please let me know.

I want each module to contain it's own routes file, with routes that simplify the module's actual URL.

For example, I have a products module and it contains 2 controllers: cart and catalog.
I can hit the pages for these by going to products/cart/ and products/catalog,
but I'd like to be able to route cart/ to products/cart and catalog/ to products/catalog,
which doesn't work.

Here is the code in application/modules/products/config/routes.php:

Code:
$route['products'] = 'store';

$route['catalog/(:num)/(:num)'] = "catalog/view_product/$1/$2";
$route['catalog/(:num)'] = "catalog/view_product/$1";
$route['catalog/results'] = "catalog/results";
$route['catalog/all'] = "catalog/view_all";

$route['cart'] = "cart/index";
$route['cart/(:any)'] = "cart/$1";

Any advice would be appreciated!