Adding wildcard from admin panel for page location (:any), (:num)
  • Hi Admin,

    I tried adding a location URL from the admin panel which was previously being served from the _variable file. The URL is as follow :

    about-us/board-of-directors/enterprises/(:any)

    We need to make the page admin driven and hence I wanted to add a page for this URL, How can I go about this request. As each time I try adding (:any) or \(:any\), the characters get be escaped
  • Try just :any instead of (:any).
  • Hi Admin,

    I tried adding only :any at the end of the URL but still I am not getting the page. I am getting a 404 for any fragment I use at the end of the URL.

    about-us/board-of-directors/enterprises/:any in the browser gives the desired page
    about-us/board-of-directors/enterprises/{director-name} in the browser gives 404.

    Thanks.
  • Try adding the following to the MY_fuel.php 'max_page_params' config value:
    $config['max_page_params'] = array('about-us/board-of-directors/enterprises/' => 1);
  • I added the above line in the config file.
    Now,

    about-us/board-of-directors/enterprises/:any in the browser gives the desired page
    about-us/board-of-directors/enterprises/{director-name/any-other-word} in the browser gives the page at "about-us/board-of-directors/enterprises/" route.
  • If there are 2 parameters being passed to that page then change the "1" to a "2".
  • No {director-name/any-other-word} -> this was just for representation purpose, that If I use anything in the final uri_segment then I am getting the page same as

    about-us/board-of-directors/enterprises/

    Do I have to make any change to the location parameter of the page
    about-us/board-of-directors/enterprises/:any , currently this is used as the location
  • Hi Admin,
    Any luck here.. I tried allowing certain characters in the config/config.php file's permitted_uri_chars but still the same result.

    I tried debugging around :any in the Pages controller of the fuel folder but didn't find anything relevant just a line which is already doing its part

    $key = str_replace(':any', '.+', str_replace(':num', '[0-9]+', $key));

    // Does the RegEx match?
    if (preg_match('#^'.$key.'$#', $field_values['location']))
    {
    $routes[] = $key;
    }


    Stuck on this for some time now. Any help would be appreciated. Thanks.
  • I think I found the issue and it's a bug in the code. I've posted a fix in the develop branch (which you can merge in with GIT):
    https://github.com/daylightstudio/FUEL-CMS/commit/a71d525e64c562e4854621e69194ac2189a1ced5
  • AWESOME, it worked.
    Thanks alot..

Howdy, Stranger!

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