View more context


Jennifer Tigner

Hey, I’m trying to set up routes/templates and having issues. I’ve tried a million different things and just can’t get it to work. I have my route set up like

  1. 'privacycenter//$BUID/$AppID/$Action': 'PrivacyCenterPage_Controller'

and then in my controller

  1. class PrivacyCenterPage_Controller extends Page_Controller {
  2. private static $allowed_actions = array('home', 'apps', 'login');
  3. private static $url_handlers = array(
  4. '' => 'home',
  5. '$BUID' => 'apps',
  6. '$BUID/$AppID/login' => 'login',
  7. );
  8. function init() {
  9. parent::init();
  10. }
  11. function home() {
  12. $data = array( 'TestVar' => "home page", );
  13. $template = array("PrivacyCenterPage");
  14. return $this->customise($data)->renderWith($template);
  15. }
  16. function apps() {
  17. $data = array('TestVar' => "app list section",);
  18. $template = array("PrivacyCenter_AppList", "PrivacyCenterPage");
  19. return $this->customise($data)->renderWith($template);
  20. }
  21. function login() {
  22. $data = array('TestVar' => "account infoasdfasdf",);
  23. $template = array("PrivacyCenter_AppLogin", "PrivacyCenterPage");
  24. return $this->customise($data)->renderWith($template);
  25. }

My templates are set up like templates/ templates/Layout/ templates/Layout/ templates/Layout/

When I go to /privacycenter or /privacycenter/123 it renders the templates just fine, but when I get to /privacycenter/123/456/login it just gives a 404. It doesn’t even render the outermost templates/ Any ideas?

Jennifer Tigner

When I debug out the URL params it correctly assigns the values in the URL to the route pattern I gave it.

Jennifer Tigner

Finally solved after days! lol. It turns out that the $url_handlers have to be ordered from most specific to least specific.

👍 (2)

Is there a way to loop parent pages without having the call the page template directly? Such as <% loop Parent %>


It's either $Parent or $Up... (I believe)


but that won’t loop anything, it’s just a single page


$Parent.Parent.Children would loop all parent pages; but for that you need to be at least at the second level. $Menu(1) would loop all top pages...


that will loop all siblings of a single parent page… not all parent pages


might be the flat level-above list of pages, might be vertical hierarchy