Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
1.2.1 not support this router?
  • 'article/:id'=>'post/post_view/$1',
      
     
     'article/page/:page'=>'post/post/$1',
    
    will not work
  • With named params you don't use $1, unless you make them a regex by placing them in brackets. See http://docs.fuelphp.com/general/routing.html#/advanced
  • oh,
    'article/page/:page'=>'post/post', 
     'article/:id'=>'post/post_view', 
     'article'=>'post/post',
    
    it works.
    now router url need
    Router::get
    
    if controller action
    \Uri::create
    
    is there any function support router and controller url create.
    if router not exsits will use controller/action.
  • To be able to use Router::get() you need to defined a named route:
    'article/page/:page'=> array('post/post', 'name' => 'article_page'),
    

    You can then do
    // will return "http://yoursite/article/page/16";
    $url = Router::get('article_page', array('page' => 16));
    

    No need to use Uri::create(), you use that to create your links manually. Note that this only works (with named params and regexes) as of v1.3, not in v1.2.1. So you might want to switch to 1.3/develop, or copy the Route and Router classes from 1.3/develop to your application. This has all been documented, so please take the time to read before asking these questions.

Howdy, Stranger!

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

In this Discussion