Advertisement
Guest User

SilverStripe Defined Route

a guest
Apr 30th, 2015
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.58 KB | None | 0 0
  1. //config.php
  2. <?php
  3. Director::addRules(100, array (
  4.     PluginPage::$url_segment => 'PluginPage'
  5.  
  6.  
  7. //PluginPage.php
  8. <?php
  9.  
  10. class PluginPage extends Page_Controller {
  11.  
  12.     private static $allowed_actions = array (
  13.         'detail'
  14.     );
  15.  
  16.     static $url_segment = "my-route";
  17.  
  18.     /**
  19.      * Initialize the controller and load the dependencies.
  20.      */
  21.     public function init() {
  22.         parent::init();
  23.     }
  24.  
  25.     /**
  26.      * Controller action for the index view
  27.      *
  28.      * @return SSViewer
  29.      */
  30.     public function detail() {
  31.  
  32.         return $this->customise(array(
  33.         ))->renderWith(array("PluginPage","Page"));
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement