I've a problem with getting a variable in a file, which is included through a static class method.
one.php:
require_once("classes/tools.class.php");
$variable = "variable";
Tools::setView("test");
tools.class.php:
class Tools{
public static function setView($viewName){
if(!is_file("views/" . $viewName . ".php")){
echo "Chyba pri nacitani view: \"$viewName\" v " . $_SERVER["SCRIPT_NAME"];
die();
}
else{
include "views/" . $viewName . ".php";
}
}
}
view/test.php:
echo $variable;
After "echo" i got the "Undefined variable" error.
Can somebody help me with this problem, please?
Thanks!