commit
9136aa72d6
1 changed files with 29 additions and 2 deletions
31
src/View.php
31
src/View.php
|
|
@ -9,7 +9,7 @@ class View {
|
|||
* Root path for includes app folders
|
||||
*/
|
||||
|
||||
static public $root_path=__DIR__;
|
||||
static public $root_path=".";
|
||||
|
||||
/**
|
||||
* A set of paths inside of $root_path contining views. If a view is located, the foreach for search the view is break
|
||||
|
|
@ -95,6 +95,12 @@ class View {
|
|||
|
||||
static public $header=array();
|
||||
|
||||
/**
|
||||
* An array with config_paths for load configurations.
|
||||
*/
|
||||
|
||||
static public $config_path=['settings'];
|
||||
|
||||
/**
|
||||
* The construct for create a view object
|
||||
*
|
||||
|
|
@ -117,6 +123,19 @@ class View {
|
|||
|
||||
}*/
|
||||
|
||||
static public function load_config()
|
||||
{
|
||||
|
||||
//Load config here
|
||||
foreach(View::config_path as $config)
|
||||
{
|
||||
|
||||
Utils::load_config("config_views", $config);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Very important function used for load views. Is the V in the MVC paradigm. Phango is an MVC framework and has separate code and html.
|
||||
*
|
||||
|
|
@ -181,6 +200,14 @@ class View {
|
|||
|
||||
$func_view=View::$cache_template[$template];
|
||||
|
||||
if(!function_exists($func_view))
|
||||
{
|
||||
|
||||
throw new \Exception('Error: Template file loaded but function '.$func_view.' not found: '.implode(' and ', $all_path));
|
||||
die;
|
||||
|
||||
}
|
||||
|
||||
//Load function from loaded view with his parameters
|
||||
|
||||
//array_unshift($arr_template_values, $this);
|
||||
|
|
@ -578,7 +605,7 @@ class View {
|
|||
|
||||
$_SESSION['flash_txt']='';
|
||||
|
||||
return View::load_view(array($text), 'common/utilities/flash');
|
||||
return View::load_view(array($text), 'common/utils/flash');
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue