CGI Output

They have: 88 posts

Joined: Mar 1999

Quick question from a novice -

I have a cgi script that performs
rather well apart from it displays
the results on a blank page.

How do i get it to display in a
centre frame so that I can blend
it in with the rest of the site?

Apologies if I haven't explained myself
properly. Many thanks in advance for
any assistance given.

Regards

Steve

They have: 5,633 posts

Joined: Jan 1970

Do you really mean “frame” or do you want to print the output of a CGI script in a particular place on a HTML web page? If so you’d normally use SSI (server side includes) to call the script and “print” the data on the page. Just make sure you have SSI enabled on your host and name the HTML files .shtml or .shtm and then add <!--#exec cgi="/cgi-bin/script.cgi"--> to the page, where you want the script to print. Try referring to the scripts readme or home page (if there is one) for more information.

Good luck,

------------------
Adam
AIS Internet Solutions
[email protected]
www.aisinternet.com

They have: 334 posts

Joined: Dec 1999

I understand what you want, but you need to clarify things a bit. I take it that you're using a script you downloaded and set-up, but that you didn't write it yourself. There are ways to customize the output to make it look like the rest of your site instead of that plain white page, but it would help to know how the script was written in the first place. Some scripts use template files to control the appearance of the output. If this is one of those scripts, then it's pretty simple. All you do is edit the HTML code in the template to make it look like the rest of your site.

However, some simpler scripts write the output code into the script itself. Look through the code of the xxx.cgi file to try to find something that looks like this:

code:

print "<html>\n";
print "<head><title>TITLE</title></head>\n";
print "<body bgcolor=white text=black link=blue vlink=blue>\n";
print "some output message\n";
print "</body\n";
print "</html>\n";
[/code]

All that can be changed to match your site output. Like if your site uses a background image and red text, that code could become:

code:
print "<html>\n";
print "<head><title>TITLE</title></head>\n";
print "<body bgcolor=white bg=image.gif text=red link=blue vlink=blue>\n";
print "some output message\n";
print "</body\n";
print "</html>\n";
[/code]

Obviously, a complicated site layout becomes a lot more difficult to handle, but it's still doable with a little effort. However, it might be easier to dump the script if that's the case and find a script that's based on template files for output. Perl is not nearly as forgiving of errors as HTML is, so it'll be less painful in the long run to use HTML templates rather than rewriting the xxx.cgi script itself. 

They have: 1,587 posts

Joined: Mar 1999

ssi might be the easiest way to pull it off as someone else mentioned.

------------------
CLICK 4 some tested resources for making money $, hosting, and web promotions.
My Site got hacked, but i'm coming back?

Traffic-Website.com free traffic, affiliate programs, hosting, & domain names.
My Site got hacked, but i'm coming back?

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.