velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geir Magnusson Jr. <ge...@adeptra.com>
Subject Re: Context & variables in templates
Date Tue, 17 Dec 2002 12:12:39 GMT

On Tuesday, December 17, 2002, at 07:05 AM, Denis wrote:

> Yura,
> On Tuesday, December 17, 2002, at 11:16  am, Yura Ushakhow wrote:
>
>>>> Kind people, need your help. How could I ask velocity if mytpl.vm 
>>>> has reference to $myvar inside , before merging? I need it, to know 
>>>> what context user wants instead of generating everything, - just 
>>>> the parts it needs.
>>> That's usually an inversion of things - the controller usually has a 
>>> clue...
>>
>>> In contrib/temporary/templatetool you'll find a little (unsupported) 
>>> class that will return to you a list of references... see if that 
>>> helps...
>> Much thanks, Geir! Very grateful.
>>
>> Speaking of inversion of things, it might be - idealogy-wise. Though 
>> I cannot think of another way to do it. Say, there might be a 
>> variable in templates which, to fill itself with data, must poke a 
>> SQL server for a large request. But whether web-designer wants to use 
>> that variable or not depends on him. So you can clearly see that it 
>> saves great a time, if he (designer) doesn't really use it.
>
> Do you need to do the request at a different time than you render the 
> template?
> If you don't, then you can simply do the request in the accessor of 
> the variable.

Exactly - put a tool in the context where the access of it gets the 
data....

>
> -- Denis.
>
>>
>> By the by, if I'm not mistaken, there was a name to such way, think 
>> it was called "Pull-model" ? I.e., when designer tells the controller 
>> what he wants. Don't remember precisely.
>>
>> Anyhow, much appreciate your help!
>> Yura.
>
>
> --
> To unsubscribe, e-mail:   
> <mailto:velocity-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: 
> <mailto:velocity-user-help@jakarta.apache.org>
>
>
-- 
Geir Magnusson Jr                                   203-355-2219(w)
Adeptra, Inc.                                       203-247-1713(m)
geirm@adeptra.com


--
To unsubscribe, e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>


Mime
View raw message