Code: Select all
<?php
require realpath(dirname(__FILE__).'/TemplateLite/class.template.php');
class Template
{
private $template;
function __constructor()
{
$this->template = new Template_Lite();
if(is_object($this->template)) echo "Template is Object<br />\n";
// Caching
$this->template->cache = true;
$this->template->cache_lifetime = 1800;
$this->template->cache_dir = realpath(dirname(__FILE__).'/../template/cached');
// Compiled
$this->template->compile_dir = realpath(dirname(__FILE__).'/../template/compiled');
$this->template->force_compile = false;
// Template Folder
$this->template->template_dir = realpath(dirname(__FILE__).'/../template');
}
function __call($function, $arguments)
{
$reflection = new ReflectionClass('Template_Lite');
$method = $reflection->getMethod($function);
/*
* Have to debug this. Works currently but haven't checked for methods that have more than zero
* parameters.
*/
return $method->invokeArgs($this->template, $arguments);
}
}
?>Code: Select all
<?php
require realpath(dirname(__FILE__).'/classes/core.template.php');
$template = new Template;
$templateLite = new Template_Lite;
?>Var dump of $template
Code: Select all
object(Template)#1 (1) {
["template:private"]=>
NULL
}Code: Select all
NULLCase 1: I thought it might have to do with Template_Lite class being coded for PHP 4, but that wasn't right.
Case 2: Using the RelectionClass class, I was am to dump the contents of the class, so the case 1 was wrong was confirmed here.
Case 3: I did think for a second I had a lapse of insanity, but alas I was not so lucky.
Case 4: With all of my experience with New, I have never experienced such a result.
Case 5: First I extended the Template_Lite class and in the constructor tried to change the values, but the values would have update. Using Parent::variable = 'value' gave an error and using $this->variable would not update the parent values.