Hi, On Sat, Oct 25, 2008 at 2:03 PM, Tobias Schlitt <[EMAIL PROTECTED]> wrote: >> I especially like the concept of subclassing instead of including. > > Looks interesting, indeed. However, a major drawback here is, that one > does not know, which parts are overwritten in which derived templates. > That will create a maintanance mess, in larger projects.
It depends on the needs. Although variable overloading should be done in the controller or possibly view-handling, you might need to let an inexperienced programmer overload HTML headers per-template which would be easier for him to do in HTML than source-hacking, depending on the application. On the other hand, when there really are 15-20 blocks on a complex page, the consequences of having as much dynamic includes can be as catastrophic. I do agree that template inheritance can be easily abused and cause drawbacks, as seen on their wiki with the "title" block for example[0]. Anyway, this is trivial to implement with any template language like eZ Template: - parse templates from the "children" to "parents" with the Template API, - the first parsed block contents is used when another block with the same name is found, Example: - render article.ezt which has {block "foo"}bar{/block} - render layout.ezt which has {block "foo"}oldbar{/block} - contents of block "foo" will have contents "bar". This is compatible with MvcTools zone system. Best regards, James. [0]http://wiki.dwoo.org/index.php/TemplateInheritance <?php class yourTemplateBlocks implements ezcTemplateCustomBlock { public static function getCustomBlockDefinition( $name ) { switch ($name ) { case "block": $def = new ezcTemplateCustomBlockDefinition; $def->class = __CLASS__; $def->method = $name; $def->hasCloseTag = true; $def->startExpressionName = "blockName"; $def->requiredParameters = array("blockName"); $def->optionalParameters = array(); return $def; } return false; } static public $blocks = array(); static public function block( $parameters, $text ) { $name = $parameters['blockName']; if( array_key_exists( $name, self::$blocks ) ) { return self::$blocks[$name]; } else { self::$blocks[$name] = $text; return $text; } } } -- Components mailing list Components@lists.ez.no http://lists.ez.no/mailman/listinfo/components