On Wednesday 29 August 2007 14:32, Tobias Schlitt wrote: > On 08/29/2007 04:18 PM Frederik Holljen wrote: > > On Wednesday 29 August 2007, Derick Rethans wrote: > >> On Wed, 29 Aug 2007, Frederik Holljen wrote: > >>> On Wednesday 29 August 2007, Kore Nordmann wrote: > >>>> On Wed, 2007-08-29 at 13:50 +0200, Raymond Bosman wrote: > >>>>>> 1) Use Structs / Objects > >>>>>> > >>>>>> You may combine lots of information in some structs or objects > >>>>>> representing logical objects in your application, and pass nothing > >>>>>> more but them, like a $request-Struct containing all request > >>>>>> information. > >>>>>> > >>>>>> You are probably already dooing this, but the logical seperations > >>>>>> still result in too many variables? > >>>>> > >>>>> Something like?: > >>>>> > >>>>> {use $send} > >>>>> {$send->a} > >>>>> {$send->b} > >>>>> > >>>>> And $send is a default object send to each Template? > >>>> > >>>> Hmm, nice idea. :) > >>> > >>> It's basically a global variable... but how do you know which global > >>> variables are available in a template? > >> > >> Right.., instead of this, it would be more practical to *indicate* it is > >> a global (as in option 4). > > > > You still don't know what global variables are available though. The only > > way to find out is to read the php source which is exactly what we wanted > > to avoid... > > The use of global variables is considered "bad application design" in > any programming language I know. Do you think it is a good idea to > introduce such stuff in the template language at all?
Those 'globals' in the templates are limited to calling template and underlying templates. Not system wide. In a certain way we can also see it as as member variables from a class. (Except that we don't write '$this->'). > I personally like the struct approach. That way, you keep all the good > ideas behind the "send-use" syntax and don't need to pass a variable for > each data value you need in a sub-template. Yes. But when this is used too much, the variables are also not visible. As written in another email: 2. Having the global $send or a function call getSendVariables() does not make it clear which variables are available. Also the checks to see if certain variables are given, are omitted; thus result in some less obvious error messages. Having a global $send is the same as forwarding $send, IMO. Thanks for the feedback.. Raymond. -- Components mailing list Components@lists.ez.no http://lists.ez.no/mailman/listinfo/components