Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Include CGI ?

Quote Reply
Include CGI ?
Hello all,

Basically i use the tag below in site_html_templates.pl (Links 2.0) to include the cgi into search result, but how in Links SQL 2.1.0 ?

Please help ..


sub insertcgi {
#----------------------------------------
# Insert Ringtones
my $ad = `/path/to/cgi/x.cgi`;
$ad =~s,Content-type:\stext/plain,,;
return $ad;
}
Quote Reply
Re: [reenee] Include CGI ? In reply to
sub {

my $ad = qx/$script_path/;
$ad =~s,Content-type:\stext/plain,,;
return $ad;

}

Last edited by:

RedRum: Mar 5, 2002, 2:33 PM
Quote Reply
Re: [reenee] Include CGI ? In reply to
Expanding a bit on that, add a global called 'ad' with the contents:

sub {
my $ad = `/path/to/cgi/x.cgi`;
$ad =~ s,Content-type:\stext/plain,,;
return $ad;
}

and then put <%ad%> in your template.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Include CGI ? In reply to
My bad, it's geting late and it wasn't very helpful I guess Unsure
Post deleted by reenee In reply to
Quote Reply
Re: [reenee] Include CGI ? In reply to
Not sure whether you saw Alex's answer or not but Build > Template Globals

Last edited by:

RedRum: Mar 5, 2002, 2:37 PM
Quote Reply
Re: [RedRum] Include CGI ? In reply to
Thanks Alex and Paul.
Quote Reply
Re: [Alex] Include CGI ? In reply to
I want to be able to place a poll (example, poll #1) wherever I want.

If it were a virtual include, it would be:
<!--#include virtual="/cgi-bin/forum/gforum.cgi?do=poll_ssi;poll=1"-->

But I want to put in Gforum and Links on cgi-generated pages.

So, using your model, I created a global called one_poll

sub {
my $one_poll = "/cgi-bin/forum/gforum.cgi?do=poll_ssi;poll=1";
$one_poll =~ s,Content-type:\stext/plain,,;
return $one_poll;
}

But it does not produce the poll, it just returns the text string:
cgi-bin/forum/gforum.cgi?do=poll_ssi;poll=1

What am I doing wrong?

Thanks so muchSmile
Quote Reply
Re: [tora] Include CGI ? In reply to
Hi,

If you don't way to use SSI, your global should return the content of the url, not that url only. And you need to the work of SSI, something like this:

sub {
use LWP::Simple;
my $one_poll = "/cgi-bin/forum/gforum.cgi?do=poll_ssi;poll=1";
$one_poll=get($one_poll);
$one_poll =~ s,Content-type:\stext/plain,,;
return $one_poll;
}

Cheers,

Dat

Programming and creating plugins and templates
Blog
Quote Reply
Re: [tandat] Include CGI ? In reply to
Thank you for your reply.

The global does not produce any output.

I tried it with other cgi urls too - still nothing.

Could you check the syntax? I do not know what to look for.

I will use the global in both Links and Gforum.

Thanks!!Smile
Quote Reply
Re: [tora] Include CGI ? In reply to
Something below should work:

sub {
use LWP::Simple;
my $prefix ="http://www.yourdomain.com";
my $one_poll = "/cgi-bin/forum/gforum.cgi?do=poll_ssi;poll=1";
$one_poll=get("$prefix$one_poll");
$one_poll =~ s,Content-type:\stext/plain,,;
return $one_poll;
}

Cheers,

Dat

Programming and creating plugins and templates
Blog
Quote Reply
Re: [tandat] Include CGI ? In reply to
Wonderful!!! It works perfectly!!

Note: the tag in the template has to be unescaped.

Thanks!!SmileSmileSmile
Quote Reply
Re: [tandat] Include CGI ? In reply to
Thanks again for your great help. Now something else, related:

I want to use the global tag in a post, so the result of the global shows when the post is read.

I do not want to put the tag in the template. I want to put it into the post field of the database.

Preferably, I want to put it in when the post is created, but if necessary, another programme (maybe php) can put the global into the post field of the database, but then when the post is made available for reading, the global-generated information should be available.

Any ideas how to do this?
Quote Reply
Re: [tora] Include CGI ? In reply to
Hi,

I am not sure what you wanted.

Cheers,

Dat

Programming and creating plugins and templates
Blog