For Programmers: Free Programming Magazines  


Home > Archive > PERL CGI Beginners > February 2006 > CGI - HTML::TEMPLATE - How do it ?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author CGI - HTML::TEMPLATE - How do it ?
Augusto Flavio

2006-02-02, 6:55 pm

Hi,


I`m have a question. i want to do a table using the module HTML::Template. Well.. A simple table i can do but a table with differents rows i don`t made(sorry my english).. How i do a table like this:

http://www.smartlinks.com.br/~aflavio/test.html


Thanks for all


Augusto Morais



---------------------------------
Yahoo! doce lar. Faça do Yahoo! sua homepage.
Charles K. Clarkson

2006-02-02, 6:55 pm

Augusto Flavio wrote:
> Hi,
>
>
> I`m have a question. i want to do a table using the module
> HTML::Template. Well.. A simple table i can do but a table with
> differents rows i don`t made(sorry my english).. How i do a table
> like this:
>
> http://www.smartlinks.com.br/~aflavio/test.html
>


That's not a very complicated table. Just 3 rows by six
columns. Why is it giving you problems?


Charles K. Clarkson
--
Mobile Homes Specialist
254 968-8328


Augusto Flavio

2006-02-02, 6:55 pm

The problem is my array... Look:


@domains = (
{ name => 'domain1.com'},
{ name => 'domain2.com'},
{ name => 'domain3.com'},
);

where i place the subdomain of the value domain2.com ?



thanks!


Augusto Morais



"Charles K. Clarkson" <cclarkson@htcomp.net> escreveu: Augusto Flavio wrote:
> Hi,
>
>
> I`m have a question. i want to do a table using the module
> HTML::Template. Well.. A simple table i can do but a table with
> differents rows i don`t made(sorry my english).. How i do a table
> like this:
>
> http://www.smartlinks.com.br/~aflavio/test.html
>


That's not a very complicated table. Just 3 rows by six
columns. Why is it giving you problems?


Charles K. Clarkson
--
Mobile Homes Specialist
254 968-8328



--
To unsubscribe, e-mail: beginners-cgi-unsubscribe@perl.org
For additional commands, e-mail: beginners-cgi-help@perl.org







---------------------------------
Yahoo! doce lar. Faça do Yahoo! sua homepage.
Charles K. Clarkson

2006-02-02, 6:55 pm

Augusto Flavio wrote:

: The problem is my array... Look:
:
:
: @domains = (
: { name => 'domain1.com'},
: { name => 'domain2.com'},
: { name => 'domain3.com'},
: );
:
: where i place the subdomain of the value domain2.com ?


@domains = (
{ name => 'domain1.com'},
{ name => 'domain2.com',
subdomain => 'www.domain2.com',
},
{ name => 'domain3.com'},
);

And in the template add a variable for sub domain in
the appropriate spot. You may need to turn off
"die_on_bad_params" when you initialize the template.

<tmpl_if subdomain>
<tmpl_var subdomain>
</tmpl_if>


A more robust solution would allow for multiple sub domains.
Use this and an inner loop named "subdomains". The "if" part
may not be necessary. You'll need to test it.

@domains = (
{ name => 'domain1.com'},
{ name => 'domain2.com',
subdomains => [
{ name => 'www.domain2.com' },
{ name => 'foo.domain2.com' },
{ name => 'bar.domain2.com' },
],
},
{ name => 'domain3.com'},

);

And in the template something like this.

<tmpl_if subdomains>
<tmpl_loop subdomains>
<tmpl_var name>
</tmpl_loop>
</tmpl_if>


HTH,

Charles K. Clarkson
--
Mobile Homes Specialist
254 968-8328


















David Dorward

2006-02-02, 6:55 pm

On Thu, 2006-02-02 at 16:36 -0300, Augusto Flavio wrote:
> The problem is my array... Look:


> @domains = (
> { name => 'domain1.com'},
> { name => 'domain2.com'},
> { name => 'domain3.com'},
> );
>
> where i place the subdomain of the value domain2.com ?


{
name => 'domain2.com',
subdomain => 'www.domain2.com',
},

--
David Dorward <http://dorward.me.uk/>
"Anybody remotely interesting is mad, in some way or another."
-- The Greatest Show in the Galaxy
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com