setFile method cannot be used without the class constructor
llaville opened this issue · comments
Hello,
I would like to use your Text_Template package in such condition
$tplDir = dirname(__FILE__) . DIRECTORY_SEPARATOR;
try {
$mainTemplate = $tplDir . 'genext.skeleton.tpl';
$tpl = new Text_Template();
// cannot be used due to exception raised
$tpl->setFile($mainTemplate);
} catch (Exception $e) {
die ($e->getMessage());
}
But I should only use it with the class constructor like that :
$mainTemplate = $tplDir . 'genext.skeleton.tpl';
$tpl = new Text_Template($mainTemplate);
Else I got InvalidArgumentException raised
"Template file could not be loaded."
To keep features as expected, I suggest to modify class constructor as :
public function __construct($file = '')
{
if (!empty($file)) {
$this->setFile($file);
}
}
Regards.
Sorry but I hate such situation with an issue opened so long time.
I can also understand that this feature is not acceptable for you for any reason, so I prefer to close it.