Example #1
0
 /**
  * Return a rendered view
  *
  * @param array $args First element is filename of partial second element is data to assign to partial
  * @return string Rendered view
  */
 public static function run($args)
 {
     $file = $args[0];
     if (isset($args[1])) {
         $data = $args[1];
     } else {
         $data = array();
     }
     $partial = new \Mnl\View();
     $partial->assign($data);
     return $partial->fetch($file);
 }
Example #2
0
 /**
  * Get layoutfile and insert view content
  *
  * @param string $file Filename of layout
  * @return string Complete page with layout and view content
  */
 public function fetch($file = 'layout.phtml')
 {
     $layout = new \Mnl\View();
     $layout->assign($this->vars);
     $layoutResult = $layout->fetch($file);
     $layoutResult = str_replace("{content}", $this->viewContent, $layoutResult);
     return $layoutResult;
 }