CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
including a cgi script in an html page

 



flanman
Novice

Dec 21, 2000, 2:59 PM

Post #1 of 6 (403 views)
including a cgi script in an html page Can't Post

Hi,
I am real new to perl/cgi so please bare with me. I have a script written for me that will produce my companies stock information in a small table automatically. How do I embed that into a web page so that when the page loads the info is automatically posted? I have it working as a hyperlink, but would like to have the info posted on the page immediately when users log onto our home page.

Thanks,
flanman



slinky
Deleted

Dec 21, 2000, 8:34 PM

Post #2 of 6 (397 views)
Re: including a cgi script in an html page [In reply to] Can't Post

You can call the script using SSI. Just put the SSI marker in your document where you want to print out the table. You can find out more about SSI at http://www.bignosebird.com/ssi.shtml



SirAnvil
Deleted

Dec 22, 2000, 12:26 PM

Post #3 of 6 (393 views)
Re: including a cgi script in an html page [In reply to] Can't Post

If your server does not support SSI as mine. Then someone posted in the FAQ section on this site how to use an INIFRAME to do it. However Netscape doesn't like it, but it works for IE folks.

SirAnvil


Mortimer
journeyman

Dec 26, 2000, 3:07 AM

Post #4 of 6 (361 views)
Re: including a cgi script in an html page [In reply to] Can't Post

Adjust this to suit your needs, and put it between the head tags of your index.html file.

<meta http-equiv="refresh" content="1; url=http://www.dmscripts.com/cgibin/DMwebsite.cgi?menu=Home">

This particular piece of code redirects the browser to a Perl script which takes care of a few different chores including page hit counting, generating the home page and collecting a few other useful stats. Works fine in IE and Netscape.
If you visit my web site, you'll first see a blue background with;
"Loading page. Please wait..." If you want to see the source code, you'll have to be quick on the mouse as it is set for 1 second.

Dave. (Wannabe Perl hacker).
www.dmscripts.com - davemortimer@one.net.au



Aquilo
journeyman

Dec 26, 2000, 5:57 AM

Post #5 of 6 (360 views)
Re: including a cgi script in an html page [In reply to] Can't Post

And also if you don't like that shtml extension and your server allows you to override the config files "most don't" you could always make Apache parse html files!

Adding this to your .htaccess file:

AddType server-parsed html

------------------------------------------------------------------------
If you want to get out of that crazy cgi-bin add this:

AddHandler cgi-script pl
or
AddHandler cgi-script cgi

------------------------------------------------------------------------
And to make any page in a directory the default home.html, index.html add this:

DirectoryIndex your_script.pl

------------------------------------------------------------------------
To do all that add this to your .htacces file:

DirectoryIndex your_script.pl
AddHandler cgi-script pl
AddType server-parsed html


Now I was told if your script uses a templet.html to print it's info that you can't use AddType server-parsed html to make that server parse html files because The template.htmls are read by your cgi script and sent directly back to the browser and thus never affected by an .htaccess file. But I do have SSI calls on such templet.html files and the call go's thru so results will very!

And using “DirectoryIndex your_script.pl” can help hide your scripts name "no practical resone" so you can just call it
www.your_site.com/dir/?info=stocks




flanman
Novice

Dec 27, 2000, 12:38 PM

Post #6 of 6 (348 views)
Re: including a cgi script in an html page [In reply to] Can't Post

Thank you everyone for your help. I did not have ssi, but Mortimers suggestion worked perfectly. This forum is great. Thanks for all the input.

flanman :)


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives