Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to make a CGI page look better

Status
Not open for further replies.

jahjah

Technical User
Jan 23, 2003
32
GB
I have a cgi script which is working fine and has all the details I need - it could do with a bit of colour - where withing the cgi script would I set body color etc...

 
CGI programs output normal HTML to the browser. All you need to do is open the cgi script in a text editor and search for <body>.

Now if the HTML color is hard coded you can change it there. If it is not hard coded you will have to find the variable that sets the color some place else in the script. The program may also parse another file to gather the HTML code and then produce the output. As you can see, this can get more complicated the more advanced the program becomes. Send us some code after you search and we will see what we can do.
 
Haunter
thanks for getting back to me, I couldnt find <body> within the script, here is what i have;

#!/appl/bin/perl
use CGI qw:)standard);
use IO;
$query = new CGI;
print $query->header,
start_html(&quot;Web Pager Gateway&quot;),
h2(&quot;Web Pager Gateway&quot;),
h2(&quot;SMS Messaging Centre&quot;).
hr();
unless ($query->param) {
&getnums;
print $query->start_form( -name=>&quot;Input&quot;);
print &quot;Enter your message here:&quot;;
print $query->hr;
print $query->textarea( -name=>'message',
-rows=>2,
-columns=>80);

print $query->hr(&quot;Select the recipients (use the Control key to pick several)&quot;);
print $query->p;
print $query->scrolling_list(
-name=>'recipients',
-values =>\@vals,
-size=>8,
-multiple=>'true'
)
;
print $query->hr(&quot;Press this button to send&quot;);
print $query->p;
print $query->submit(-value=>'Send Message');
print $query->end_html;
}
else {
@names = $query->param;
$message = $query->param('message');
@recipients = $query->param('recipients');
$recipientlist = join(&quot;,&quot;,@recipients);
$recipientlist =~ s/ //go;
$output = '/usr/local/bin/sms_client ' .
$recipientlist .
&quot; \&quot;&quot; .
$message .
&quot;\&quot;&quot;;
system $output;
print &quot;Message \&quot;$message\&quot; sent to: &quot; ;
print $recipientlist;
print p;
print $output;
print $query->end_html;
}
sub getnums {
open SMSRC, '/usr/local/etc/sms/sms_addressbook';
while (<SMSRC>) {
next if /^#/;
next if /^SMS_default_service/;
($name,$num) = split(&quot;=&quot;);
chop $num;
$code{$name} = $num if $num;
}
@vals = keys %code;
}
 
The 'body' tag is being printed by the 'start_html' method. That method is imported with the CGI.pm module and accepts some arguments. See the docs for the CGI.pm module.


Additionally, your can drop in your own HTML particulars as the output is created. 'hope this helps

If you are new to Tek-Tips, please use descriptive titles, check the FAQs, and beware the evil typo.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top