Hi Puneet,
Thanks for your/everybody's help. I had to
edit the Template file ( i.e the htm file in linux,
instead of in the frontpage editor ), and with the
correct syntax provided by everyone on this list I
could get this thing working ( $template->param(lname1
=> "xyz" );.
The @paramteres = $template->param();
returns the parameters which are defined in
the template file. So in my case it returned lname1.
Thanks,
Girish
--- Puneet Kishor <[EMAIL PROTECTED]> wrote:
> Girish,
>
> You need to look at the HTML::Template docs
> carefully.
>
> On Tuesday, July 15, 2003, at 06:08 AM, Girish
> Agarwal wrote:
>
> > @parameteres = $template->param();
> > No parameters are returned.
>
> what is this? As Andrew stated, this is conceptually
> just the opposite
> of what you should be doing. You need to store
> things in
> $template->param(somevariable => somevalue);
>
> you are doing just the opposite. You are stuffing
> $template->param()
> into an array called @parameters. Why?
>
>
> >
> > $template->param(lname1 => "Girish"); statement
> >
>
> that is the correct way to declare and store a
> variable... you do this
> in your perl script. In your template this populates
> a variable called
> <tmpl_var lname1> with the value "Girish".
>
> If you have tabular data then you use an array.
> Actually, you use a
> reference to an array which has as its elements
> anonymous hashes.
> Something like this
> $template->param(sometable => [EMAIL PROTECTED]);
>
> for example, using DBD's fetchall_arrayref to select
> values from a
> table can be done like so
>
> my $tbl_ary_ref = $sth->fetchall_arrayref({});
> $sth->finish;
> $dbh->disconnect;
>
> then you can say
> $template->param(sometable => $tbl_ary_ref);
>
> in you template then you will need to set up a
> <tmpl_loop>, etc. But,
> that is slightly more advanced.
>
> Follow the directions above for simple values
> (scalars) and do read the
> docs. The docs really are very simple and extremely
> well written.
>
> If things still don't work, post your entire script
> (provided its not
> tooooooo long ;-) ) and I will rewrite the important
> portions for you
> so you will be on your way.
>
> Hope this helps,
>
>
> > --- Puneet Kishor <[EMAIL PROTECTED]> wrote:
> >>
> >> On Sunday, July 13, 2003, at 08:00 PM, Girish
> >> Agarwal wrote:
> >>
> >>> Hi All,
> >>> I am new in the HTML::Template world.
> >>
> >> welcome.
> >>
> >>
> >>> My Situation,
> >>> I have a form with one input field for
> the
> >>> search criteria. Say search on somebody's last
> >> name.
> >>> When the User types in this field and
> >> submits
> >>> the form a perl script is called which will do
> two
> >>> things
> >>> 1) The database needs to be Queried
> against
> >> the
> >>> search criteria.
> >>> 2) A form must be displayed with all the
> >> values
> >>> from the database populated in the appropriate
> >> field
> >>> of the form.
> >>> This form I am using as a template
> HTML
> >>> file.
> >>> The form which I am using as a template
> has
> >> many
> >>> <input type=text name"blah"> fields and I have
> >> tried
> >>> them to modify it like,
> >>> <input type=text name="blah" value="TMPL_VAR
> >>> ESCAPE=HTM VALUE="lname1">
> >>> First of all is this the correct syntax I
> am
> >>> using?
> >>
> >> the correct way would be
> >>
> >> <input type="text" name="blah" value="<TMPL_VAR
> >> ESCAPE=HTML
> >> NAME=param>">
> >>
> >> or you can shorten it like so
> >>
> >> <input type="text" name="blah" value="<TMPL_VAR
> >> param ESCAPE=HTML>">
> >>
> >>> Second, I am trying to display the
> parameter
> >>> field from the template file and I don't get any
> >> put
> >>> put using something like
> >>> $template = HTML::Template->new(filename =>
> >>> /filename/);
> >>> @parameters1 = $template->param();.
> >>
> >> you open your template with
> >>
> >> my $template = HTML::Template->new(filename =>
> >> 'test.tmpl');
> >>
> >> and then assign params like so
> >>
> >> $template->param(firstname => "Girish");
> >> $template->param(lastname => "Agarwal");
> >> etc.
> >>
> >>
> >>> Please advise, how I can the data populated
> >> in
> >>> the appropriate fields in the resulting Form.
> >>
> >> then, assuming your template has been written
> >> correctly using the
> >> syntax shown above, the input fields in the form
> >> will get populated.
> >>
> >> Keep in mind, this assumes you are correctly
> >> querying the database,
> >> retrieving the records as an array of hashes, or,
> in
> >> the case of a
> >> single record, as a hash table with the db fields
> as
> >> its keys, and the
> >> values as its values.
> >>
> >>> Secondly, How do I display hover buttons
> >> using
> >>> HTML::Template module. I only get java class
> >> loading
> >>> and nothing happens
> >>>
> >>>
> >>
> >> sorry, no idea. I could be wrong, but iirc,
> "hover
> >> buttons" (I have no
> >> idea what they are) are not a part of the
> >> HTML::Template module.
> >>
> >> Hope this helps.
> >>
> >> Please do look at the H::T docs at
> >>
> >
>
http://html-template.sourceforge.net/html_template.html.
> >> The docs are
> >> really clear and very helpful. There is little I
> can
> >> think of that is
> >> not covered by these docs.
> >>
> >> (aside note: H::T, in my view, is one of those
> rare
> >> modules where I
> >> just can't think of anything else that could be
> >> added to it or
> >> changed... what a gem).
> >>
> >>
> >>
> >>
> >
>
-------------------------------------------------------
>
=== message truncated ===
__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com
-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the
same time. Free trial click here: http://www.vmware.com/wl/offer/345/0
_______________________________________________
Html-template-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/html-template-users