-
-
Save svandragt/0f0bb3a33845712b0ecb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$SomeTitle | |
$ControllerMethod("This doesn't get passed to the method and there is no other way to call ControllerMethod AFAIK?") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Some_Controller extends Page_Controller { | |
private static $allowed_actions = array ( | |
'SomeAction', | |
); | |
private static $url_handlers = array( | |
'SomeAction//$ID/$Name/$Rubbish/$MoreRubbish' => 'SomeAction' | |
); | |
public function SomeAction(SS_HTTPRequest $r){ | |
// ... | |
return $this | |
->customise(array( | |
'SomeTitle' => 'SomeTitle', | |
)) | |
->renderWith(array('SomeAction','Page')); | |
} | |
public function ControllerMethod( $argument = null) { | |
return "ControllerMethod: ($argument)"; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% loop Things %> | |
<% include FailingInclude SomeTitle = $Top.Title, ControllerMethod = $Top.ControllerMethod %> | |
<% end_loop %> | |
<% include WorkingInclude %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$SomeTitle | |
$ControllerMethod("This get passed through") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Includes can't directly access the parent scope of the scope active when the include is included. Therefore I have to pass the ControllerMethod via a variable - this then prevents me using the method with an argument, it's always null and if made required results in the following error: