[htmltmpl] Alternate loops

2005-12-01 Thread Jonathan Lang
Requiring that all loops be handled by iterating through lists of hashes leads to a lot of extra work on the script writer's end, and results in the template writer having rather inflexible data to work with. I'd like to propose a more flexible alternative, which ought to be usable in addition to

Re: [htmltmpl] loop through a hash structure without knowing the hash keys?

2005-12-01 Thread Mathew Robertson
I agree too - what I was trying to say was that, I dont think it is even technically possible to do it generically. Can you think of an example of how to do it generically?  If you can, I could quite easily modify my H::T version to support this functionality. Mat Boon Chew wrote: I agr

Re: [htmltmpl] loop through a hash structure without knowing the hash keys?

2005-12-01 Thread Boon Chew
It might be difficult to do for multilevel nested data structure, but I think having support for one of the most common data structure, array of hash, is a good start, because array of hash mirrors the structure of a resultset coming back from a DB query.Currently we can use tmpl_loop to

Re: [htmltmpl] loop through a hash structure without knowing the hash keys?

2005-12-01 Thread Boon Chew
I agree with you that the coupling cannot be totally avoided, but being able to deal with template var generically in the presentation layer is very useful in avoiding having to create duplicate html code that are doing exactly the same thing.  - boonMathew Robertson <[EMAIL PROTECTED]> wr

Re: [htmltmpl] loop through a hash structure without knowing the hash keys?

2005-12-01 Thread Jonathan Lang
Boon Chew wrote: > It might be difficult to do for multilevel nested data structure, but I > think having support for one of the most common data structure, array of > hash, is a good start, because array of hash mirrors the structure of a > resultset coming back from a DB query. You're reading m

Re: [htmltmpl] Re: HTML::Template bug report: Problems using cache

2005-12-01 Thread Mathew Robertson
Since there wasn't any new release for more than one year I would also like to ask you whether this package is still maintanted. It's still maintained, although I'm too busy to spend a lot of time on it right now. Maybe next year... But it would still

Re: [htmltmpl] loop through a hash structure without knowing the hash keys?

2005-12-01 Thread Boon Chew
I want a way to quickly display all the info in a var - a Dumper output if you will.  But more than that, like in some other server-side language, you can query the column lists (or hash keys) and loop through those and use a piece of generic code when all you intend to do is to display everyth

Re: [htmltmpl] loop through a hash structure without knowing the hash keys?

2005-12-01 Thread Mathew Robertson
The coupling of a template to the template-params is something that cant really be avoided - at some point the template designer has to have some understanding of what template-variables are being generated.  Since you are the developer creating the code that generates the template-variables, i

Re: [htmltmpl] looping through a subset of data?

2005-12-01 Thread Mathew Robertson
This is easiest achieved if you use H::T::Expr, eg:        ...     Mathew Boon Chew wrote:  Another newbie question about HTML::Template. Is there a way to output only a subset of a loop variable? For instance, let's say I have a template var that is a reference to array of ha

Re: [htmltmpl] loop through a hash structure without knowing the hash keys?

2005-12-01 Thread Mathew Robertson
It sounds like you need a tool which simply dumps the template variable names (ie: using the $ht->params() function), rather than some special mode to H::T Mathew Boon Chew wrote: Ya sorry, that's what I meant. Right now I am working on some site code, and the designer sometimes have to

Re: [htmltmpl] loop through a hash structure without knowing the hash keys?

2005-12-01 Thread Jonathan Lang
> PS. I maintain a version of H::T which supports sub-classing so that you > can create your own TMPL tags, see: > http://members.optusnet.com.au/~mathew Nice, except that I can't extract it from the computer that I'm at (grumble, WinXP, grumble, public library computer, grumble). Could someone

Re: [htmltmpl] loop through a hash structure without knowing the hash keys?

2005-12-01 Thread Carl Franks
> e.g. > > > a TMPL_LOOP doesn't take a hash, it takes an array-ref of hash-refs that would be my @loop = ( {name => 'a'}, {name => 'b'}, ); $tmpl->param( students => [EMAIL PROTECTED] ); If you knew that already, give an example of what sort of data you want to put in, and what you want

[htmltmpl] looping through a subset of data?

2005-12-01 Thread Boon Chew
 Another newbie question about HTML::Template.Is there a way to output only a subset of a loop variable? For instance, let's say I have a template var that is a reference to array of hashes of  X elements (essentially a recordset with X rows of data), is it possible to output just the first

[htmltmpl] loop through a hash structure without knowing the hash keys?

2005-12-01 Thread Boon Chew
I can't find a way in the doc to loop through hash without knowing the keys in the hash.  If this feature is not available, I think the fact that the template has to always such intimiate knowledge of what's being passed to it is not always a good thing, it also makes it impossible to just du

Re: [htmltmpl] loop through a hash structure without knowing the hash keys?

2005-12-01 Thread Boon Chew
Ya sorry, that's what I meant.Right now I am working on some site code, and the designer sometimes have to come to me for stuff because he doesn't always know what hash keys I am passing to him (say sometimes I might add a new one, sometimes he mistype one, etc.).  The whole point of doing t

Re: [htmltmpl] Re: HTML::Template bug report: Problems using cache

2005-12-01 Thread Mitar
Hi! On 11/30/05, Sam Tregar <[EMAIL PROTECTED]> wrote: > On Tue, 29 Nov 2005, Jozef Kosoru wrote: > > Since there wasn't any new release for more than one year I would also like > > to ask you whether this package is still maintanted. > > It's still maintained, although I'm too busy to spend a lot