This is the documentation for concrete5 version 5.6 and earlier. View Current Documentation

After the path to a single page is matched, further path parts will get matched to actions (functions in the single page controller or single pages below it). Any remaining path parts can become parameters to the function, provided the function declares parameters to accept them.

For example if you have a single page at /mysite/mypage/, by default, function view() in the single page controller for mypage will be called.

If you now have a path /mysite/mypage/category/subcategory/ and the view() function has a couple of parameters:

function view($cat, $subcat);

Then this path will also map to view(), but only if view() has enough parameters to accept the additional parts of the path and only if you don't also have another single page /mysite/mypage/category/ or an action function in the single page controller which the Concrete5 dispatcher will give precedence to:

   function category ($subcat);

You can't just pull path parameters out of the arguments array because the Concrete5 dispatcher decides based on declared parameters. On the other hand, you can declare a long list of parameters just in case, to make it grab whatever path may be thrown at the function in your mypage single page controller:

function view($p0, $p1, $p2,..... $p42){
  $args = func_get_args();
  foreach ($args as $arg){
    // Do something based on the arg value
  }
}

Within the Concrete5 core, this is handled by the Request object and function getRequestedPage(). The path is successively trimmed to the next ‘/’ from the right until a matching single page controller is found, then matched forward against actions and their parameters in the single page controller.

Read more How-tos by JohntheFish

Loading Conversation