Ubiquity 2.5.2
php rapid development framework
Loading...
Searching...
No Matches
SimpleViewController.php
Go to the documentation of this file.
1<?php
2
4
14abstract class SimpleViewController extends Controller {
15
16 public function __construct() {
17 }
18
19 protected function _includeFileAsString($filename, $pData) {
20 if (isset ( $pData )) {
21 \extract ( $pData );
22 }
23 \ob_start ();
24 include ($filename);
25 return \ob_get_clean ();
26 }
27
39 public function loadView(string $viewName, $pData = NULL, bool $asString = false) {
40 $filename = \ROOT . \DS . 'views' . \DS . $viewName;
41 if ($asString) {
42 return $this->_includeFileAsString ( $filename, $pData );
43 }
44 if (isset ( $pData )) {
45 \extract ( $pData );
46 }
47 include ($filename);
48 }
49}
Base class for controllers.
Default controller displaying php views only.
__construct()
Constructor initialize $view variable.
loadView(string $viewName, $pData=NULL, bool $asString=false)
Loads the php view $viewName possibly passing the variables $pdata.