I'm currently building a CMS for a project in codeIgniter and I was wondering if there's any way to create dynamically a controller file in codeIgniter via the CMS when the user create a new page in the database. I don't need to create another model because the tables in the database will be the same, as well as the view. Basicly, all the page in the website (link, title, content etc.) are from the same table. I just want to keep the uri like this (www.mywebsite.com/class/function). Also no routing.
I was looking around the web and the only thing I found close of my request is the CRUD "codegen", but i can't use it online and there's alot of things I just don't need from it.
While it is possible to create a new controller each time the user adds a new page to the database, would it not be better to have a single controller which takes the db id or page name as parameter and loads that page?
So if the user created two pages called page1 and page2, and you have a controller that is used to serve all dynamic pages named dynamic.php then the urls would be
www.mysite.com/dynamic/page1
www.mysite.com/dynamic/page2
Creating a controller each time the user creates a page is a big overhead, and also would require lots of code to properly implement, like deleting the controller when the user deletes the page from database, for instance. And I think to provide a coding solution within SO would be cumbersome.