LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 10-11-2005, 01:00 PM   #1
zaveko
LQ Newbie
 
Registered: Apr 2005
Location: istanbul
Posts: 7

Rep: Reputation: 0
how to print my CGI programs output inside an HTML


Hello guys,
I have a CGI program that outputs some HTML codes but now a whole page.
I want to show this server-side created HTML code inside another HTML page.

lets say my CGI program output this line "Hello, it is Friday today"

I want people to be able to use this CGI script by just using a link to the script but how?

since I want everyone to be able to use it, I cant force them to have SSI in their web server.

thanks
 
Old 10-11-2005, 02:57 PM   #2
Quigi
Member
 
Registered: Mar 2003
Location: Cambridge, MA, USA
Distribution: Ubuntu (Dapper and Heron)
Posts: 377

Rep: Reputation: 31
The other HTML page could use frames.
 
Old 10-11-2005, 03:01 PM   #3
zaveko
LQ Newbie
 
Registered: Apr 2005
Location: istanbul
Posts: 7

Original Poster
Rep: Reputation: 0
firstly thank you for your intereset

and,
this is not what I want because that complicates the web page design. and if i give a text based counter service, it would be difficult for customers to use the counter in their page, forcing them to use frame
 
Old 10-11-2005, 03:17 PM   #4
ralvez
Member
 
Registered: Oct 2003
Location: Canada
Distribution: ArchLinux && Slackware 10.1
Posts: 298

Rep: Reputation: 30
Well then... your choices are: use an <iframe> it is simple to use and avoids the issues of <frame>, or use a flash movie and return the output into it.
Yet another option would be to use a layer but I think that could complicate things... (you just got me thinking here!! )

Hope this helps

Rick
 
Old 10-11-2005, 04:00 PM   #5
zaveko
LQ Newbie
 
Registered: Apr 2005
Location: istanbul
Posts: 7

Original Poster
Rep: Reputation: 0
i dont know how iframe works, i will examine it now however it does not sound so good to me to use iframe to print only one single line of sentece for example. lets take the counter service example, my cgi script will only output the number of people who visited the member site. using iframe for only showing this number?... i think there should be other way like <script src=counter.cgi> way but how..

thanks
 
Old 10-11-2005, 04:17 PM   #6
Quigi
Member
 
Registered: Mar 2003
Location: Cambridge, MA, USA
Distribution: Ubuntu (Dapper and Heron)
Posts: 377

Rep: Reputation: 31
Guess why so many counters out there are images :-) It's not trivial (for the including page) to do it with text.

(I didn't understand from the original page that it was a counter for use by other people.)
 
Old 10-11-2005, 04:34 PM   #7
zaveko
LQ Newbie
 
Registered: Apr 2005
Location: istanbul
Posts: 7

Original Poster
Rep: Reputation: 0
do you mean making a graphical counter is more simple than doing a text based one. god.
 
Old 10-11-2005, 05:41 PM   #8
ralvez
Member
 
Registered: Oct 2003
Location: Canada
Distribution: ArchLinux && Slackware 10.1
Posts: 298

Rep: Reputation: 30
Very well then... use SSI and an include file. That will do exactly what you want. You end up using text, the output gets to the client from the server and no fuss whatsoever with <frames> and/or <iframe>
Read you apache manual for details.

Rick
 
Old 10-11-2005, 06:22 PM   #9
Quigi
Member
 
Registered: Mar 2003
Location: Cambridge, MA, USA
Distribution: Ubuntu (Dapper and Heron)
Posts: 377

Rep: Reputation: 31
Making a graphical counter may be a bit more challenging. But using it is simpler, because you can put a simple IMG tag in a page. For example (to use one that Google returns for "counter"), <img src="http://freelogs.com/counter/index.php?u=asdf"> (you may want to incude width and height for smoother page layout). I'm not aware for an equally simple way to include external HTML fragments.
 
Old 10-11-2005, 06:37 PM   #10
zaveko
LQ Newbie
 
Registered: Apr 2005
Location: istanbul
Posts: 7

Original Poster
Rep: Reputation: 0
thanks for everyone who tried to help and actually helped

here is what works

My CGI script, named third.cgi after compilation (written in C)
#include <stdio.h>
int main()
{
printf("Content-type: text/javascript \n\n");
printf("document.write('Hello from Istanbul, Turkey');\n");
return 0;
}


When it is called from a page by
<script src="/cgi-bin/third.cgi"></script>

Hello from Istanbul, Turkey

is printed.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
simple q: can you use php inside an html document? BrianK Programming 2 12-10-2004 10:31 PM
Cookie Sharing Between CGI generated HTML pages and standard HTML pages rkwhited Linux - Newbie 5 08-15-2004 08:39 AM
Control print output from PHP/HTML... PDF? alar Linux - General 1 08-05-2004 02:20 AM
JavaScript inside a CGI for date validation....doesn't work!! vous Programming 3 08-27-2003 05:49 PM
retriving mysql data, and placing it inside a table in html using perl rhuser Programming 1 03-12-2003 06:04 AM


All times are GMT -5. The time now is 04:07 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration