Advertisement
Guest User

Maiku MOri

a guest
Nov 24th, 2009
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.26 KB | None | 0 0
  1. <?php
  2.  
  3. namespace web2bb;
  4.  
  5. class baseController
  6. {
  7. @@  //protected $breadcrumbs, $view, $content=null;
  8. @@  protected $breadcrumbs, $view, $content=null, $disableLayout=false;
  9.  
  10.     public function __construct()
  11.     {
  12.         $this->view = new \web2bb\view;
  13.  
  14.         /*** create the bread crumbs ***/
  15.         $bc = new \web2bb\breadcrumbs;
  16.         // $bc->setPointer('->');
  17.         $bc->crumbs();
  18.         $this->view->breadcrumbs = $bc->breadcrumbs;
  19.  
  20.         // a new menu instance
  21.         $menu = new \web2bb\menuReader( __APP_PATH . '/modules' );
  22.         $this->view->menu = $menu;
  23.     }
  24.  
  25.     public function __destruct()
  26.     {
  27.         if( !is_null( $this->content ) )
  28.         {
  29. @@          if ($this->disableLayout) {
  30. @@              $result = $this->content;
  31. @@          } else {
  32. @@              $this->view->content = $this->content;
  33. @@              $result = $this->view->fetch( __APP_PATH.'/layouts/index.phtml' );
  34. @@          }
  35.             $fc = FrontController::getInstance();
  36.             $fc->setBody($result);
  37.         }
  38.     }
  39. }
  40.  
  41.  
  42.  
  43.  
  44. @@//THEN IN YOUR MODULE CONTROLLER ACTION:
  45.  
  46. @@$this->content = $JSONString;
  47. @@$this->disableLayout = true;
  48.  
  49. @@//Or if you don't want to make these changes for whole application, just copy paste __destruct() into your module controller which will make it local to your module.
  50.  
  51. @@//I can't guarantee you that it works, just typed it off my head,
  52. @@//Maiku Mori
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement