Welcome Guest, Not a member yet? Register   Sign In
Creating a database-driven dynamic route **SOLVED**
#11

[eluser]garethfoote[/eluser]
Hi all,

Wired designs; I think your solution is what I'm looking for. My problem is exactly that which is stated in the intial post.

I basically need to set dynamic routes based on values in my DB. I therefore want to specify a 'fallback controller' if no controllers matching the uri segments are found in the controllers dir.

This is however my first nail biting experience of extending the CI core and I am not sure about how this is implemented.

I assume that to implement your solution I need Modular Extension (done)and the to set my 'fallback controller' name in config/routes.php under
Code:
$route['404'] = 'fallbackcontroller'

I assume then that I perform the logic to confirm that the entered uri segment is present in my database and if not then I manually route to an actual 404 page.

I could be well off base here but I'm risking mockery nonetheless. Hope you can help.

Thanks,

Gareth
#12

[eluser]olimortimer[/eluser]
Digging up an old topic...sorry!

I use the MY_Router from post #4 (http://ellislab.com/forums/viewthread/135105/#666746) in my CI and it does exactly what I need it to do - either load the controller if it exists, or pass requests to another controller to handle pages from the database.

What I'd like to do is implement HMVC (https://bitbucket.org/wiredesignz/codeig.../wiki/Home) but I can't get the MY_Router to work properly - unfortunately the example in #5 (http://ellislab.com/forums/viewreply/666747/) doesn't work either.

Does anyone have an updated version of this MY_Router which does the same thing, but works with HMVC?

Thanks!




Theme © iAndrew 2016 - Forum software by © MyBB