Jump to:

3431 Posts in 1025 Topics by 864 members

Template Questions

SilverStripe Forums » Template Questions » Controller Routing

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 517 Views
  • ColdBlooded
    Avatar
    Community Member
    4 Posts

    Controller Routing Link to this post

    Very confusing issue. Spent hours on digging but no joy. Allow me to explain:

    I've followed the documentation on http://doc.silverstripe.org/framework/en/topics/controller but doesn't work.
    Bumps me to this page (screenshot):

    I have put this in _config.php:

    Director::addRules(50, array(
    'everything/$Action/$ID'=>'EverythingController'
    ));

    No Joy.

    I followed documentation at (http://doc.silverstripe.org/framework/en/topics/controller) - no joy. Same issue (See screenshot above).

    How do I unable controller?

    Source code for EverythingController.php:

    <?php

    class EverythingController extends Controller {

    function bio(){

    $id = $this->urlParams['ID'];
    $bio = DataObject::get_by_id("Bio",$id);
    return $this->renderWith("RoleSelect",array("Bio"=>$bio));

    }
    }

    ?>

    Everything I have done should work when I url to: link.com/everything/bio/2 - BUT IT DOESN'T

    It always worked before. I think the issue came up when I started using the framework from the git repo at https://github.com/silverstripe/silverstripe-framework

    Anyone with same issue?
    Any solution / pointers / any guesses of what could be wrong?

    Thank you.

  • Willr
    Avatar
    Forum Moderator
    5482 Posts

    Re: Controller Routing Link to this post

    Note that in 3.0 you should use the new config system for that - http://doc.silverstripe.org/framework/en/reference/director#routing

    After you make any changes to the config system make sure you do a ?flush=1

  • ColdBlooded
    Avatar
    Community Member
    4 Posts

    Re: Controller Routing Link to this post

    Hi Willr,

    Thank you for your reply.

    The solution was simply to have //$Action instead of /$Action in the _config.php file.

    517 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.