Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Route from controller
  • hi i have some questions regarding routing
    can we control the routing from the controller? for example my [url=http://mysite/index.php/blogme]http://mysite/index.php/blogme[/url]
    If want to check whether 'blogme' is page or modules if it is page which is in the database then is page then it should show the content of the page else it is name of the module then it should call a module 'blogme'. thank u in advance
  • There are several ways to achieve that. You can add code to the config/routes.php, and just generate custom routes (from for example a database). You can cache that for performance reasons. You can use a front controller. Just route all requests to that controller, do your checks in that controller, and have the action return a new request object (making it an HMVC call). You can even call the destination controller directly, just instantiate it, and call the action method from your first controller. For my CMS, I use the second option, where the front controller also deals with themes and templates, and uses HMVC calls to fetch the contents for the different sections in the template.
  • Ok thank u WW , i will use second idea just like u have done in your cms .
  • samitrimal, I have just finished DbRoutes check it out at https://github.com/Phil-F/Fuel-DbRoutes I have also started a thread in codeshare. Phil.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion