These are the class definitions
<?php
abstract class MyTemplate {
protected $arrayOfSpaces;
protected $arrayOfVariables;
protected $output;
protected abstract function __construct();
function outputHTML(){
echo $output; //Apparently, the problem is HERE. <<<<>>>>>
}
}
class MyTemplateMain extends MyTemplate {
function __construct(){
$this->output="<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
<html>
<head>
</head>
<body>
I love Rock n Roll!!!
</body>
</html>";
}
}
?>
And this is where I launch this page
<?php
require_once("view/templates.php");
$page=new MyTemplateMain();
$page->outputHTML();
?>
Doesn't work, though. Just shows a blank page, without the String I love rock n roll which was supposed to appear in the body.
I'm sure there are better ways to implement templates but I just want to figure out why this particular example doesn't work
Any help is appreciated. Thanks
PS: The quotes are all duly escaped and the file paths are ok too