Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Routing problem to default controller action_index
  • 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?

  • SyntaxlbSyntaxlb
    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
  • Thanks Syntaxlb works like a charm.

Howdy, Stranger!

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

In this Discussion