Hi,
I'm doing some page generation. In that page would be some (HTML) SELECT
fields, whose contents would be pulled from database.
I've decided to use Template module and to make whole job as elegant as it
can be.

The table from which the data is pulled looks something like this
TABLE kategorija
 katid CHAR[4]
 name  VARCHAR[20]

*
I can create SELECT object simply by fetching whole table, generating an
array of katid's and hash of katid => name pairs.
Then I can simply pass to $query-scrolling_list() reference to the first
array, and a hash. And the pass the result to template.
This isn't very memory savvy alghorhytm, but what to do...

**
Then I make everything little trickier. What if there is an error in users
input. The page has to be shown again, indicating where the error is, AND
leaving everything else intact, just to save the users from retyping.
This is simple, just fetch with $query->param users's choices in that SELECT
field, and pass reference to that array to scrolling_list() method of CGI.
After that, the resulting construct can be passed to Template module.

Both of these look somewhat clumsy and plain, eating much memory...

So for the * I came to another idea:
to use Template plugin DBI.
So, after fetching one row, build OPTION field, et voila:
<OPTION value=[% arr.0 %]> [% arr.1 %]
etc.

But how can I set preselected fields as described in **???

Another question:
If I write at the script's begining:
use CGI;
use Template;

and in template file:
[% USE CGI %]
would CGI module be loaded twice?


-- 
...  Kako jogurt moze da bude topli obrok?

         - --- -- ---=- --==---===-[Nikola Knezevic]---===--------+
+- -=- -==--=- -=-- --- -- - http://users.hemo.net/indy --- -- -



_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

Reply via email to