Re: Multiptle lines of output

Dan <[email protected]> Fri, 12 Dec 2008 10:17:25 -0500
Newsgroups gmane.text.clearsilver.general
Message-ID <[email protected]>
Brandon Long([email protected])@2008.12.09 15:22:30 -0800:
> x = 
> for (type, hostname, ipaddr, t) in dnsdata:
>   ncgi.hdf.setValue("Entry.%d.type" % x, type)
>   ncgi.hdf.setValue("Entry.%d.hostname" % x, hostname)
>   ncgi.hdf.setValue("Entry.%d.ipaddr" % x, ipaddr)
>   ncgi.hdf.setValue("Entry.%d.time" % x, t)
> 
> Then, in the template:
> 
> <form action=>
> <?cs each:entry = Entry ?>
>   <input type=text name="entry.<?cs var:name(entry) ?>.type"
>          value="<?cs var:html_escape(entry.type) ?>">
>   <input type=text name="entry.<?cs var:name(entry) ?>.hostname"
>          value="<?cs var:html_escape(entry.hostname) ?>">
>   <input type=text name="entry.<?cs var:name(entry) ?>.ipaddr"
>          value="<?cs var:html_escape(entry.ipaddr) ?>">
>   <input type=text name="entry.<?cs var:name(entry) ?>.time"
>          value="<?cs var:html_escape(entry.time) ?>">
> <?cs /each ?>
> </form>
> 
> And then, to read them back:
> 
> node = ncgi.hdf.getChild("Query.entry")
> dnslist = []
> while node != None:
>   dtype = node.getValue("type", "")
>   hostname = node.getValue("hostname", "")
>   ipaddr = node.getValue("ipaddr", "")
>   t = node.getValue("time", "")
>   dnslist.append( (dtype, hostname, ipaddr, t) )
>   node = node.next()
> 
> Obviously, you'll probably use different input elements, and you
> need to actually validate the results, but that's the basic gist.

Thanks, that makes sense, but I still can't seem to get values out of
HDF (empty). Is there a way to dump the whole HDF for debugging?

Thanks.