Love Fuel?
Donate
About
Forums
Discussions
Login
FuelPHP Forums
Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Tips and Tutorials
Module : Edit the route
Syntaxlb
March 2013
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 ?
Harro
March 2013
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.
Add a Comment
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Apply for Membership
Categories
All Discussions
5,088
General
↳ General
3,364
↳ Job Board
13
↳ Installation & Setup
214
Packages
↳ Oil
213
↳ Orm
700
↳ Auth
260
Development
↳ Tips and Tutorials
126
↳ Code share
145
↳ Applications
52
In this Discussion
Harro
March 2013