Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
How to organize semantic urls for dynamics pages?
  • At the first I tried to organize routes in this way:

    'specific/route' => 'specific/controller',
    ....
    '_root_'   => 'index/index',
    '_404_'    => 'index/404',
    '_403_'    => 'index/403',
    ':any' => 'index/index', // controller managing semantic urls for dynamic pages

    But, in this way to many specific routes needed to describe all regular controller/action pairs existing in my project.

    At the second I decided to use _404_ for managing semantic urls:

    'specific/route' => 'specific/controller', // only needed for changed (not standard) urls
    ...
    '_root_'   => 'index/index',
    '_404_'    => 'index/index', // controller managing semantic urls for dynamic pages
    '_403_'    => 'index/403',

    Is there another way to get desirable functionality without strange tricks and keeping standard routing behavior for regular controller/action pairs?

    In my mind I see it something like this:

    'specific/route' => 'specific/controller', // only needed for changed (not standard) urls
    ...
    ':standard' => '', // mark point for standard routing (if controller/action exsists then run it, if no - try next route)
    '_root_'   => 'index/index',
    '_404_'    => 'index/404',
    '_403_'    => 'index/403',
    ':any' => 'index/index', // controller managing semantic urls for dynamic pages
  • HarroHarro
    Accepted Answer
    I'm not really the person to anwer. 

    Our apps don't use routing (as in the route config) at all. we only have one :any route to our front controller, which assembles the page using different sections via a database lookup. 

    So it is a view driven design, the lookup sets up a theme instance, and the different sections in the theme view (like header, footer, sidebar, body, etc) are callbacks to controller actions.

    Not something I would advise for small and/or simple apps...
  • Ok, thank you for answer anyway.

Howdy, Stranger!

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

In this Discussion