Re: [Fwd: Re: [PEAR-DEV] MVC revisted]

From: Date: Tue, 11 May 2004 20:29:40 +0000
Subject: Re: [Fwd: Re: [PEAR-DEV] MVC revisted]
References: 1 2 3 4 5 6  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-29112@lists.php.net to get a copy of this message
Hi,
Since PHP5 helps code interfaces I think it's a good way to go. In a framework a template engine should be seen as a black box. We feed a template and data, and we ask for the result. We should care if the engine uses blocks, tags, pseudo-code or if the template is a string, a file or taken from a database. Here's a preview of what I'm writing (that's work in progress, I can't even guarantee that it would parse properly ;-) -Philippe <?php interface Interface_ContentGenerating {
    abstract public function openTemplate($template);
    abstract public function setData($name, $data = null);
    abstract public function setDataByRef($name, &$data);
    abstract public function output();
    abstract public function toFile($filename);
    abstract public function toString();
}
I'm sorry, but something like this will *not* work, when it comes to templating enginges. I have developed a templating engine that provides several features that are not provided by common engines. The architecture is split up in a dozen of smaller classes, e.g. I got a reader class that is interchangeable which allows me to read from files, databases, or whatver you like. Template engines differ extremely in approach and feature set, so there's no way that HML_Template_IT, Flexy, Smarty and patTemplate will provide a common API for different features. Stephan

« previous php.pear.dev (#29112) next »