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.
General
Routing problem to default controller action_index
KoolCoder
June 2014
Hi,
I need to pass in a page name to the action_index for loading different pages from the database.
I have searched every where and cannot find out how to do this.
The Controller_Page is routed as the default controller.
So if I have
http://my.dev/
this goes to the home page fine.
But if I have
http://my.dev/about
I get an error how can I pass the about param to the action_index method?
Or is there a better solution for this?
So is this possible?
Syntaxlb
June 2014
Accepted Answer
The route :
'(:slug)' => array('page/index', 'name' => 'page_show'),
And you get the slug in your action_index() in Controller_Page with : $this->param('slug') ?
If you go on :
http://your-fuel-url/about
, $this->params('slug') = "about" in your controller
KoolCoder
June 2014
Thanks Syntaxlb works like a charm.
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,089
General
↳ General
3,364
↳ Job Board
13
↳ Installation & Setup
214
Packages
↳ Oil
213
↳ Orm
700
↳ Auth
261
Development
↳ Tips and Tutorials
126
↳ Code share
145
↳ Applications
52
In this Discussion
KoolCoder
June 2014
Syntaxlb
June 2014