Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

cgi script for html pages

by rjsaulakh (Beadle)
on Dec 15, 2005 at 15:43 UTC ( #516982=perlquestion: print w/replies, xml ) Need Help??
rjsaulakh has asked for the wisdom of the Perl Monks concerning the following question:

i am new to cgi and the problem i am facing is that all my include files as well as images are getting aligned to left but i want them in center of the page . would preferably want to have a table format and put all my navigatyion header, footer and brand image inside it . how should i go about it any suggestive reading

the most osrry part of it that i have to use and nothing else as that is only what i available on the server and its not possible to install new modules "

#!/usr/bin/perl use CGI; my $cgi=new CGI; print $cgi->header; $region = $cgi->param("region"); print <<HERE; <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html lang="en-GB"> <head> <title>website HERE print <<HERE1; </title> <meta http-equiv="Content-Type" content="text/html; charset=iso-88 +59-1"> <link href="../css/style.css" rel="stylesheet" type="text/css"> <script type="text/javascript" language="JavaScript"> var num=randIntNum(); </script> </head> <body> HERE1 #navigation header come here print &printer('../navigation/de_nav_bar.html'); print <<HERE2; <table cellpadding="0" cellspacing="0" width="100%"> <tr valign="top"> <td> HERE2 #brand background image comes gere print <<HERE3; <table cellpadding="0" cellspacing="0" width="100%"> <tr valign="top"><img src="images/DE_1_2_2_BKG_Fine_Dining.jpg" al +ign ="center"> <td> HERE3 # navigation footer comes here print &printer('../navigation/de_template_footer.html'); sub printer { my $a=shift; open(F,$a) or die("$a not opened\n"); my $b; { local $/; $b=<F>; } return $b; }

Replies are listed 'Best First'.
Re: cgi script for html pages
by bradcathey (Prior) on Dec 15, 2005 at 15:52 UTC

    This is really an HTML question.

    One way to avoid having to debug this kind of stuff from the CGI side, is to use a templating system like HTML::Template that separates the html from your Perl. You iron our your HTML issues before you get to the Perl/CGI. And there's *tons* of support for HTML::Template here in the monastery, e.g., Tutorials. Good luck.

    "The important work of moving the world forward does not wait to be done by perfect men." George Eliot
Re: cgi script for html pages
by wazzuteke (Hermit) on Dec 15, 2005 at 15:57 UTC
    To be honest, and without looking at the outpu very closely, this also sounds like an HTML issue more than anything. If you're getting output via the cgi, then you have enough principals down to get the dirty-work done.

    With this in mind, I would certainly searches the references in the earlier comment, because the more education will only make you a better programmer. For the HTML, there are certainly a number of free online tutorials that should help out with the formatting you're looking for. I'd simply try Googling for something like HTML tutorial or something like that.

    Good luck and have fun!

    print map{$_.' '}grep{/\w+/}@{[reverse(qw{Perl Code})]} or die while ( 'trying' );
Re: cgi script for html pages
by tphyahoo (Vicar) on Dec 15, 2005 at 15:49 UTC
Re: cgi script for html pages
by larryp (Deacon) on Dec 15, 2005 at 21:12 UTC

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://516982]
Approved by kutsu
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2018-01-21 21:01 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (230 votes). Check out past polls.