Click to See Complete Forum and Search --> : Calling/Running CGI in HTML page


DforDog
07-12-2005, 07:33 AM
Hi all,

I hope someone can help me with this :)

I have just installed a cgi script that manages links. I have got the script working OK (just some adjustments to the look needed, which I will deal with later).

The script seems to run fine.

http://www.dfordog.com/cgi-bin/hotlinks/index.cgi

But I want it to run within an HTML page so that it has my usual banner and left-hand navigation etc...

Instead of using frames (which I don't want to do) I thought I would just call the script in a table in the middle of an HTML page. So I put a piece of code to call the cgi script (I used something like 'execute' I think) so that I would have the cgi script called up in the HTML page and I changed the file extension to .shtml

It all now looks like this

http://www.dfordog.com/k9links.shtml

What I didn't bank on was that the HTML page would be completely replaced by cgi page once the user clicked on a link. To see what I mean, click on the Dog Art link. The user has now left my html page :eek:

Can anyone suggest a way round this problem or a different way I could approach this please.

Any help would be very gratefully received :o

Many thanks,

Jenny

WoD
07-12-2005, 08:36 AM
I'd really hate to tell you this, but if you want to do this you are going to HAVE to use frames.

You could go with an iFrame, which is a frame embedded into your page (inline frame) so you don't have to split it up your page into header/sidebar and content pieces.

Try

<iframe frameborder="0" marginheight="0" marginwidth="0" src="http://www.dfordog.com/cgi-bin/hotlinks/morelinks.cgi"></iframe>


- Alternatively you could wrap your CGI scripts in the layout of your main web pages, but people are still going to end up on the scripts themselves.

D for Dog
07-12-2005, 01:13 PM
Hi WoD,

Thank you so much for your reply. It was very interesting. I had never heard of inline frames before. I just tried your suggestion. Wow. Seems too good to be true. It works a treat but is there a catch? How browser friendly are these iframes? I wonder if you would be able to tell me what your opinion is of iframes before I decide to go ahead with this method. As my site is aimed at dog lovers I need to really be sure that I cater for older browsers. Not that I am saying anything in particular about dog lovers LOL :p just pointing out that my site is not aimed at businesses and other potentially more up-to-date folk. LOL, dig dig.

Alternatively you could wrap your CGI scripts in the layout of your main web pages, but people are still going to end up on the scripts themselves.

I don't mind my visitors ending up at a cgi script page, cos it is OK to do that, yes? So that would be fine. As long as everything else (banner, nav etc..) is there as well. What you seem to be suggesting is a way that I can do this, but I do not know how to "wrap my cgi in the layout of my main web pages".

You know why I thought this would be easy. I recently installed ClickCartPro shopping cart and I took the shopping cart code and just plonked it into my html page and it has all worked fine, and this is just calling a cgi script isn't it???

http://dfordog.com/cgi-bin/ccp51/cp-app.cgi

I just had a look at that page and it says things like CGIGET and CGIVAR. Double dutch to me.

I do hope you can help again and very much look forward to hearing from you.

Kind regards,

Jenny

PS I did originally have the PHP version of this script. Would that have been any different with regards doing what I want to do?

WoD
07-12-2005, 02:12 PM
You basically need to do exactly what you did with ClickCartPro for your link management script. Plonk the CGI into your HTML layout and away you go- in theory.

I have no idea what compatibility issues might arrise with iFrames, they work with browsers back to Internet Explorer 5 and possibly beyond. You can download old versions of Netscape and Internet Explorer if you are concerned with how your page might appear in them.

There are some good stand alone versions of Internet Explorer available here: http://www.skyzyx.com/downloads/
And plenty of Netscape versions available here:
http://sillydog.org/narchive/

The main issue is that they separate your content from your page layout, which is not terribly search engine friendly.

D for Dog
07-12-2005, 02:24 PM
Thanks WoD,

Hum.... maybe the iframes isn't the way to go.

So you say I should just be able to somehow plonk my cgi into my html page and do it that way?

I shall have a go :D

Thank you very much indeed for your help.

Jenny

WoD
07-12-2005, 02:45 PM
Well, the HTML would remain a CGI page and would have to be located in your CGI-BIN (what is the deal with that folder, anyway?) but you basically have the idea.

Give the HTML page the same name as your CGI, move it into the bin (the CGI-BIN) and plonk your CGI into it. I'm not CGI versed so it might not be THAT simple, but that's the basic idea.

Bear in mind that if you use PHP instead you will not have to put it in the CGI-BIN. Just make k9links.php and plonk the code into it.

D for Dog
07-12-2005, 05:34 PM
LOL, exactly :) plonk it in the cgi-bin and see how it goes.

Well, tomorrow I shall read how to plonk it in. I can't work it out right now. I have tried but I think I need to do a bit more reading up. But thank you very much for letting me know that I am on the right lines.

I thought I could work it out by looking at how I did the ClickCartPro one but that was easier as I could locate the files via an admin page and that is where I plonked it in. I have tried to find those same files in the cgi-bin and not in the cgi-bin :p but I can't find them anywhere. How silly is that, hahahahahaha.

I give up for today.

Many thanks.

I will say goodnight and eek :eek: just because I like that little face.

:)

Jenny