Re: help needed in template toolkit module

Chad Wallace <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.template-toolkit
Organization The Lodging Company
Message-ID <[email protected]>
On Tue, 1 Nov 2011 12:01:16 -0700
Chad Wallace <[email protected]> wrote:

> On Tue, 1 Nov 2011 12:40:17 +0100
> veeru reddy <[email protected]> wrote:
> 
> > You didn't include the call to XML::Simple, but I have a feeling the
> > problem is that you need to use ForceArray in XML::Simple, and then
> > traverse the expected arrays.  Without ForceArray, you'll sometimes
> > get an array of hashes and sometimes just a hash (if there's only
> > one). The man page for XML::Simple will explain it all.
> 
> I tried like that but I am very new to perl and template toolkit, and
> also to which elements i need to use force array. can you tel me and
> aafter using force arrary i need to change for loop? because I am
> learning so i asked this type of questions and also i dnt know how to
> reply post so i sended mail to you.

The elements I would give to ForceArray are the ones that can have
multiple instances, like student.  There can be one or many "student"
elements in a single "electronics" element.  Can there be more than one
"electronics" element in a single "branch" element?  And so on...

Then for the ones that you've set ForceArray on, you need a for loop to
iterate over that array one or more times and continue on beneath
them, nesting the loops as needed.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.