Created
February 19, 2016 01:47
-
-
Save muskie9/b4738e2ebf5c239a1340 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
<?php | |
class My_Controller extends Page_Controller | |
{ | |
private static $allowed_actions = array( | |
'index', | |
'TestFunction', | |
); | |
public function index(SS_HTTPRequest $request) | |
{ | |
return array( | |
'MyTemplateVar' => $this->TestFunction($request) | |
); | |
} | |
public function TestFunction(SS_HTTPRequest $request) | |
{ | |
$filter = ($request->getVar('f')) | |
? array('SomeAttribute' => explode(',' $request->getVar('f'))) | |
: array(); | |
$objects = MyObjet::get()->filter($filter); | |
if($request->isAjax()){ | |
return $this->customise( | |
array( | |
'MyTemplateVar' => $objects | |
) | |
)->renderWith('MyCustomTemplate'); | |
} | |
return $objects; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment