jasteele123

concrete5 get path from controller

Feb 4th, 2013
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.68 KB | None | 0 0
  1. <?php  defined('C5_EXECUTE') or die('Access Denied.');
  2.  
  3. class JobController extends Controller {
  4.  
  5.     private $path;
  6.     public function on_start() {    // do not use __construct()
  7.             // BEST way to get the path in a controller?
  8.         $this->path = Page::getCurrentPage()->getCollectionPath();
  9.         // $this->path = $this->getCollectionObject()->getCollectionPath();
  10.         // $this->path = Loader::helper('navigation')->getLinkToCollection(Page::getCurrentPage()); // adds slash
  11.         // $this->path = View::url('job');      // adds trailing slash, and requires the name of the view :(
  12.         // global $c;   $this->path = $c->getCollectionPath();  // global, feh
  13.     }
Advertisement
Add Comment
Please, Sign In to add comment