Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Module : Edit the route
  • Hi,

    i have create an module "lbContact", but i don't like the segment "lbContact" in my URL.

    I have create this lines in my app/config/routes.php :

        'contact(/:any)?' => 'lbContact$1'

    It's work, but now my routes.php in modules/lbContact/config/ is now useless ...

    For keep working my routes.php (module side), i have create a controller "router.php" :

    modules/lbContact/classes/controller/router.php


    <?php

    namespace LbContact;

    class Controller_Router extends \Controller_Hybrid
    {
        public function action_index($route)
        {
            return \Request::forge('lbContact/' . $route)->execute();
        }
    }

    And my line in routes.php (app side) is now :


        'contact(/:any)?' => 'lbContact/router/index$1',

    Now, it's work ! My module use custom segment "contact", and use custom routes from routes.php (module side).


    My method is good ? Or better solution exists ?
  • Can't think of it.

    Module routing is a long outstanding issue that we don't have a good solution for, but is on the table to address in 2.0.

Howdy, Stranger!

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

In this Discussion