Re: Package Proposal: HTML_Template_Dummy

From: Date: Fri, 18 Jul 2003 21:54:55 +0000
Subject: Re: Package Proposal: HTML_Template_Dummy
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-18404@lists.php.net to get a copy of this message
Hi, all,
... basically, all the template engines in PEAR are variations on two themes.
     Theme 1: Load a template with its own specific markup,
     parse the markup into values/loops/structures, (maybe
     cache the html) and output the parsed template.
     Theme 2: Load a template with its own specific markup,
     compile the template markup into a PHP script, (maybe
     cache the compiled script) and execute the compiled
     script (and maybe cache the resulting html).
Dummy is neither of those. It only acts as an encapsulator for display logic (so as to separate it from business logic) where the logic is itself already in PHP.
Dummy is Theme two with one step removed. So in my opinion it still fits in the Theme. It is just a Lite variant of it.
Hm ... yes, I can see why you would say that. Dummy certainly is Lite (or light-weight). However, I'd go so far as to say that Dummy removes more than one of those steps of Theme 2. For example, it does not use its own template-specific markup; instead, it uses "markup" that is the same as all of PHP. Dummy makes no attempt to compile the template (as the display logic has been "pre-compiled" by the developer's brain ;-) or do anything other than include the template code directly in the display() method. Dummy makes no attempt to cache anything before or after, as that is perhaps better left to the Cache class. The only thing Dummy does is act as a mediator/interface from the business logic to the display logic so that variable scope is not totally shattered, and so that methods specific to display are encapsulated away from the global function space.
To me the differences are more about pulling and pushing data. 1) Template engines like IT require you to push data into the template. 2) Template engines like Xipe require you to pull data from within the template. Dummy fits 2) and therefore it should be integrated into 2).
You said you hadn't looked at Dummy code yet; after you do, you may have a different opinion. Dummy really is a very simple, straightforward class, and I don't think it matches the "spirit" of Xipe too closely. I could be wrong, though, I often am.
Nevermind the mess we already have. Don't let it fool you to believe that template engines are any different than the other parts PEAR addresses.
No, no, I totally understand. I didn't mean to start another template-tizzy on pear-dev. :-( -- pmj

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