Hallo iedereen,
ik een php bestand die de volgende file (en class Page) aanroept.
Nu krijg ik de volgende error:
CitaatFatal error: Class 'basic\Smarty' not found in D:\Documents\scripts\time2kill\New folder\New\classes\Page.class.php on line 33
Het probleem ligt dus bij het feit dat ik een namespace gebruik en de smarty class die helemaal geen namespace gebruikt.
Hoe los ik dit op?
Dit is het bestand:
PHP
<?php
namespace basic;
function my_autoloader($class_name) // autoload function
{
//
// split up in case of namespaces
$parts = explode("\\", $class_name);
//
//check for exceptions
//Ex. Libraries
switch(end($parts))
{
case "Smarty":
$path = "/libs/Smarty";
break;
default:
$path = "";
}
require($path . "/" . end($parts) . ".class.php");
}
spl_autoload_register('basic\my_autoloader');
class Page
{
public function __construct()
{
$smarty = new Smarty();
}
}
?>
Toon Meer
Alvast bedankt,
Willem