Hi i have a php error that it hought you might be able to help with Cannot redeclare class I have researched many results but none apply or help me with my issue I have used the once of requiring/including but it still errors
And it sometimes says Notice: Undefined index: lol in C:\xampp\htdocs\template.php that is weird also because i dont understand why its like that.
The index
<?php
require_once 'settings.php';
require_once 'global.php';
if (!isset($_GET['url']))
{
include("pages/index.php");
}
if (file_exists("".$hotelurl."/pages/".$_GET['url'].".php"))
{
include("pages/".$_GET['url'].".php");
}
?>
My global.php
<?php
require_once 'template.php';
use Central as C;
$template = new C\template();
$template->Initiate();
?>
My settings.php
<?php
$hotelurl = "http://127.0.0.1";
?>
My template.php
<?php
class template
{
public $tpl;
private $params = array();
final public function Initiate()
{
$this->setParams('lol', 'centraltest');
}
final public function setParams($key, $value)
{
$this->params[$key] .= $value;
}
final public function filterParams($str)
{
foreach($this->params as $key => $value)
{
$str = str_ireplace('{' . $key . '}', $value, $str);
}
return $str;
}
final public function write($str)
{
$this->tpl .= $str;
}
final public function outputTPL()
{
echo $this->filterParams($this->tpl);
unset($this->tpl);
}
}
?>