Welcome Guest, Not a member yet? Register   Sign In
dynamic controller?
#1

[eluser]jdfwarrior[/eluser]
Wasn't 100% sure how to name this, and I'm not asking for a 100% explanation or a "tell me how to do this", I'm just looking for theoretical knowledge, because I'm not implementing this, just wanna know if it could work.

For a previous site I had created, I allowed the administrative users to be able to "Create" pages for the site. It would basically display fields for page name, title, etc, and an fckeditor to allow them to create content and so on. It would take all this info, dump it to the database, and make use of the _remap function in a specified controller (pages). The controller would check to see if the next segment in the url was something stored in the database, if so, retrieve the info, display it to the user. All easy stuff.

Where my question comes in is, the urls for the project were in the form of www.domain.com/pages/page_name. Would there be a way in CI to remove the controller name portion from the url by creating a pre_controller or pre_system hook to perform the database lookup to determine if this were a dynamic page and load a view and such from there? I'm not sure because I have never tried this, but from documentation, it would seem that pre_controller would be bad unless I could prevent an error from it trying to find a controller with that name and therefore throwing an error. Also, pre_system is so early on that only benchmark and hooks classes have been loaded, so would attempting to load views and such actually work at this point?

As I said I'm not actually implementing this right now, so don't feel the need to write code examples or anything. I'm just looking for a little more info on hooks. And maybe what are some practical applications of a hook?


Messages In This Thread
dynamic controller? - by El Forum - 03-02-2009, 10:50 AM
dynamic controller? - by El Forum - 03-02-2009, 10:54 AM
dynamic controller? - by El Forum - 03-02-2009, 11:08 AM
dynamic controller? - by El Forum - 03-02-2009, 11:18 AM
dynamic controller? - by El Forum - 03-02-2009, 11:52 AM
dynamic controller? - by El Forum - 03-02-2009, 01:00 PM
dynamic controller? - by El Forum - 06-05-2011, 01:45 AM
dynamic controller? - by El Forum - 06-05-2011, 05:21 AM
dynamic controller? - by El Forum - 07-08-2011, 02:26 AM



Theme © iAndrew 2016 - Forum software by © MyBB