Raymond Bosman wrote:
> 
> Evaluation
> ----------
> Many solutions share the same concept. Therefor we categorized the solutions
> in three groups:
> 
> - Group 1: Solution 1, 2 and 3.
> - Group 2: Solution 4 and 5.
> - Group 3: Solution 6, 7 and 8. 

I am still catching up with the mails after my vacation. It seems there 
are already 8 solutions available, but what is the problem?

> Problem
> -------
> In a system with lots of nested templates or template overrides the amount of
> variables that need to be forwarded to each template may grow out of
> proportion. The following example uses three templates: p, q, and r that
> forward all variables via includes to the underlying template:
> 
> 
> Template p:
> {use $a, $b, $c, $d, $e, $f}
> {include "q" send $a, $b, $c, $d, $e, $f}
> 
> 
> Template q:
> {use $a, $b, $c, $d, $e, $f}
> Show a: {$a}
> {include "r" send $b, $c, $d, $e, $f}
> 
> 
> Template r:
> {use $b, $c, $d, $e, $f}
> Show all variables: {$b}, {$c}, {$d}, {$e}, {$f}
> 
> 
> The user application sends all external variables:
> $t = new ezcTemplate();
> $t->send->a = 1, 
> $t->send->b = 2,
> ...
> $t->send->f = 6,
> $t->process("p");
> 
> 
> 
> In this example, we nested the templates three deep. In real applications (eZ
> publish scale) this nesting will be deeper. Another technique some
> applications use are template overrides. Basically, a template override
> decides dynamically what template to include and execute. An {if} block will
> be used in this document to simulate a in general much complexer override 
> system:
> 
> {use $load_p, $a, $b, $c, $d, $e, $f}
> {if $load_p}
>     {include "p" send $a, $b, $c}
> {else}
>     {include "q" send $d, $e, $f}
> {/if}
> 
> 
> The use-variables: a, b, c, d, e, and f are never used inside the template,
> but only forwarded. 

Is there a problem here? Are there too many variables? I think the 
application developer is responsible with the way of sending variables. 
He could group them into logical objects, for example user object (with 
fields username, language, email, etc) instead of variables username, 
language, email. Or he could just create variables like a1, a2, a3, b1, 
b2, etc. But I think this was discussed already.

It was said before that including a template into another is like 
calling a function. But then the main template (p in the examples above) 
  is also a function which is called from the "master template" (the PHP 
code which processes the main template). Why change the way included 
templates work? We would then need to change the way of including 
templates in the "master template".

-- 
Alexandru Stanoi
eZ Components System Developer
eZ Systems | http://ez.no
-- 
Components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/components

Reply via email to