outputhtml : allow an autoloader class

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@4143 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2018-03-06 09:27:54 +00:00
parent 1bd2395de9
commit 2acbd34b61

View File

@@ -36,12 +36,15 @@ class outputhtml extends output
$resView = $data; $resView = $data;
if ($viewClass !== FALSE && $viewMethod !== FALSE) if ($viewClass !== FALSE && $viewMethod !== FALSE)
{ {
if (! class_exists ($viewClass) && empty (spl_autoload_functions ())) if (! class_exists ($viewClass))
{ {
if ($module !== "") if ($module !== "" &&
file_exists ("modules/$module/views/$viewClass.php"))
require_once ("modules/$module/views/$viewClass.php"); require_once ("modules/$module/views/$viewClass.php");
else elseif (file_exists ("views/$viewClass.php"))
require_once ("views/$viewClass.php"); require_once ("views/$viewClass.php");
// If the file doesn't exists, an autoloader maybe exists. If it is not
// the case, the class will not be found
} }
$obj = new $viewClass; $obj = new $viewClass;
$resView = $obj->$viewMethod ($data, $variable); $resView = $obj->$viewMethod ($data, $variable);