I have a problem with the extends of PHP. My code in the page.class.php:
<?php
require_once ('globals.class.php');
require_once ('Smarty.class.php');
class CPage extends Smarty
{
.
.
.
In the Smarty.class.php the class name is Smarty.
So I don’t know why I get this error:
Fatal error: Class ‘Smarty’ not found in C:\xampp\htdocs\blog\www\classes\page.class.php on line 6
As you use
requireI assume that theSmartyclass has been defined.So you are probably using namespaces, which would require you to
usethat specific class or provide a fully qualified classname (FQCN) instead:Otherwise use the class on top:
to import it into your current namespace.
The answer is with the pre-condition that the
Smartyclass you refer to is in the global namespace. I’m not fluent with Smarty so I do not know if it has it’s own namespace yet, and if so, which one it is. So the concrete FQCN might vary.See as well: