The stupid question is the question not asked | |
PerlMonks |
Re: Re: Yet Another Stupid CGI Questionby George_Sherston (Vicar) |
on Oct 19, 2001 at 11:59 UTC ( [id://119897]=note: print w/replies, xml ) | Need Help?? |
My £/50 is to second the monk who said HTML::Template. In fact I don't think it's terribly difficult to learn, certainly not to get it to do what you want. You'd make a template file, say you call it results.tmpl which wd look something like:
(I like writing my TMPLs in upper case and my HTML in lower case to tell them apart visually - no other reason). Then in your perl you need a bit that looks like this Simple, really. The marginally tricky bit is getting the data into the right form to go into the template. The single line $results_tmpl->param(results => \@results); is doing duty for a lot of lines like But obviously if you had to write it all out by hand, you might as well not be using the template at all. What I'm saying is that the code for populating the template will work, but it may take a bit of effort to get your head around it (it did mine). But you said you wanted to get it on your hands... The only other problem I can foresee is that for some reason HTML::Template doesn't seem to be part of the standard issue. If you're using an ISP that doesn't offer it, you may want to refer to these threads. update :Reflectingthat this is a problem I quite often come up against, and for which I wd like a simple solution, I had a sudden rush of blood to the head and wrote a module that makes it easier to do printing out lists of info in CGI, so now there's yet One More Way To Do It. Now you can do this, which I think you'll agree has a certain classical simplicity:
§ George Sherston
In Section
Seekers of Perl Wisdom
|
|