For Programmers: Free Programming Magazines  


Home > Archive > PERL CGI Beginners > January 2005 > print $q->p(with CSS)









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 print $q->p(with CSS)
David Gilden

2005-01-16, 8:55 pm

Happy New year out there,

Is it possible to get CGI.pm to print <p class=3D"myclass">text.......</p>
I also need to print out the one these as well:

<link rel=3D"stylesheet" href=3D"/css/main.css" type=3D"text/css">
but it has to be in the <head> of the starting HTML? -- and I would like it=
=20
before the </head> and after the </title>

Is any of this possible and would be the correct syntax for this?
Below is my starting point.=20

use CGI;
my $q =3D new CGI;
print $q->header( "text/html" ),
$q->start_html( "Error" ),
$q->p( "Your upload was not procesed because the following error ",
"occured: " ),
=20


Thanks for any help on this,
Dave Gilden
(kora musician / audiophile / webmaster @ www.coraconnection.com / Ft. Wor=
th, TX, USA)


Visit my schedule page for up to the minute performance info:
<http://www.coraconnection.com/cgi-bin/schedule.pl>


=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
3D=3D=3D=3D=3D=3D=3D=3D
Cora Connection: Your West African Music Source
Resources, Recordings, Instruments & More!
<http://www.coraconnection.com/>=20
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
3D=3D=3D=3D=3D=3D=3D=3D
Ovid

2005-01-16, 8:55 pm

Hi David,

> Is it possible to get CGI.pm to print <p
> class="myclass">text.......</p>


Yes. If the first argument is a hashref, it will use the name/value
pairs as tag attributes.

print $q->p({class=>"myclass"}, "text.......");

> I also need to print out the one these as well:
>
> <link rel="stylesheet" href="/css/main.css" type="text/css">
> but it has to be in the <head> of the starting HTML? -- and I would
> like it
> before the </head> and after the </title>


print $q->start_html(
-head => $q->Link({-rel=>"stylesheet", -href=>"main.css"}),
-title => "some title"
);

See "perldoc CGI" for more detailed information.

Cheers,
Ovid

=====
Silence is Evil http://users.easystreet.com/ovid/ph...hy/decency.html
Ovid http://www.perlmonks.org/index.pl?node_id=17000
Web Programming with Perl http://users.easystreet.com/ovid/cgi_course/
Sponsored Links







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

Copyright 2008 codecomments.com