Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Include cgi-output from outside LinksSQL

Quote Reply
Include cgi-output from outside LinksSQL
hi,

I've searched the forum and found out, that there is a way to include files from outside LinksSQL.

It is sayed in the forum, that you have to use:

<%include /var/www/cgi-bin/......%>

but I always get an error:

Error: Can't load included file: '/var/www/cgi-bin/mydir/admin/templates/mylinkssqltemplate//var/www/cgi-bin/....'. Reason: No such file or directory

I am using dynamic mode and try to integrate the search-results of another cgi (DBManSQL) into my pages.



Does anyone have an idea how to solve the problem?

Regards,
Manu

Shopping Portal Shop-Netz.de® | Partnerprogramme | Flugreisen & Billigflüge | KESTERMEDIA e.K. | European Affiliate Marketing Forum.
Quote Reply
Re: [ManuGermany] Include cgi-output from outside LinksSQL In reply to
I still need help!

Regards,
Manu

Shopping Portal Shop-Netz.de® | Partnerprogramme | Flugreisen & Billigflüge | KESTERMEDIA e.K. | European Affiliate Marketing Forum.
Quote Reply
Re: [ManuGermany] Include cgi-output from outside LinksSQL In reply to
Hi,

I don't think you can execute cgi in templates - <%include ...> only seems to work with files not cgi generated output. I am not sure if you could make a global that could generate the cgi output and then include that Global.

Klaus

http://www.ameinfo.com
Quote Reply
Re: [ManuGermany] Include cgi-output from outside LinksSQL In reply to
Problem 1): Include content of another file outside the template directory.
Tricky but may be possible.

The path is relative to the template directory. Well, this is a 'feature' or GT tempate system.
That's why it wanted to read template from '/var/www/cgi-bin/mydir/admin/templates/mylinkssqltemplate//var/www/cgi-bin/....'
The only solution is to temporarily set the root path to templates before calling a template, then changing back the original value. I do not remember exactly, but as I remember this is possible. Not sure tough, and no more time to check for it.

It may be possile create a global for that task (to include another file outside the template directory).

Problem 2) Include output of another CGI?
Possible, but only by using LWP::Simple module. Search & Read perl docs for it.


EDIT: And of course NO. You can not execute cgi in templates. Only the 2) is the trick what can do the result you want.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...

Last edited by:

webmaster33: Dec 27, 2002, 1:02 PM
Quote Reply
Re: [webmaster33] Include cgi-output from outside LinksSQL In reply to
>>
You can not execute cgi in templates.
<<

Yeah you can Wink

<%CGI::escape('f o o o o o ')%>
Quote Reply
Re: [Paul] Include cgi-output from outside LinksSQL In reply to
Hmmm. Yeah, of course you can execute CGI in template (globals, function calls) Blush Tongue
I must be tired, when I wrote that sentence...

So I originally meant that, you can NOT call a CGI script from template and include the output of that CGI into the template.
Paul, is that correct now? Wink

EDIT: As I know you can not include cgi output in template using <%include /cgi-bin/variable.cgi%>. Maybe it would be possible if the cgi file would be placed to template dir, so it can be called with relative path? Anybody tested this? Paul?

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...

Last edited by:

webmaster33: Dec 28, 2002, 3:48 AM
Quote Reply
Re: [webmaster33] Include cgi-output from outside LinksSQL In reply to
Quote:
So I originally meant that, you can NOT call a CGI script from template and include the output of that CGI into the template.
Paul, is that correct now?

You can if the code is in a module using:

<%Module::function%>

....but if it is a cgi script you'd need a global to execute the script and return the output, so it can be done but would require one extra step.

I'm fairly sure the cgi include would not work as all that happens with includes is that the include is read and inserted into the template, then the parser skips back to the beginning of the include to parse any tags. The code would not be executed, it would just appear as text.
Quote Reply
Re: [Paul] Include cgi-output from outside LinksSQL In reply to
Yes, of course you can use <%Module::function%> in template.

But the original question was to use <%include /cgi-bin/variable.cgi%>.
So the bottom line is, that this basically it is not possible, but a workaround for that task could be to write a global (likely using LWP::Simple in it).
LWP::Simple can read web page from internet URL, also the output of CGI script.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] Include cgi-output from outside LinksSQL In reply to
Quote:
But the original question was to use <%include /cgi-bin/variable.cgi%>.
So the bottom line is, that this basically it is not possible, but a workaround for that task could be to write a global (likely using LWP::Simple in it).
LWP::Simple can read web page from internet URL, also the output of CGI script.

I responded to this in the final two paragraphs of my post above.

Last edited by:

Paul: Dec 28, 2002, 4:39 AM
Quote Reply
Re: [Paul] Include cgi-output from outside LinksSQL In reply to
I thought we discussed out & closed this thread...

No, you did not mention LWP::Simple. LWP::Simple is the easiest solution, what ManuGermany could use in a global.
Additionally I cleared out our discussion for reader by summarizing what we talked until now.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] Include cgi-output from outside LinksSQL In reply to
Sigh.

If anything you should use GT::URI or the newer GT::WWW to fetch a webpage.

Quote:
Additionally I cleared out our discussion for reader by summarizing what we talked until now.

Good for you.
Quote Reply
Re: [webmaster33] Include cgi-output from outside LinksSQL In reply to
Thanks to both of you!

LWP is indeed a possible but tricky method. At the moment for my BETA-test I'm using an IFRAME but this is not a good solution for not every browser can handle IFRAMES.

At the moment I'm thinking of writing my own plugin for my productdatabase-search-task. Then buying DBMan SQL would have made no sense for me but I think a plugin to get the data from the produktDB would make things easier and more sensefull.

Regards,
Manu

Shopping Portal Shop-Netz.de® | Partnerprogramme | Flugreisen & Billigflüge | KESTERMEDIA e.K. | European Affiliate Marketing Forum.
Quote Reply
Re: [Paul] Include cgi-output from outside LinksSQL In reply to
Quote:
Sigh.

If anything you should use GT::URI or the newer GT::WWW to fetch a webpage.
Paul, No reason for "Sigh"... Tongue

Thanks for additional info, but the fact, that GT::URI or GT::WWW does the same task as LWP::Simple (to fetch a webpage), means no reason to say "Sigh"...

EDIT: In the meantime, ManuGermany replied, too, so here is my answer for him.
ManuGermany: As you see, there are several solutions, use whichever you like.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...

Last edited by:

webmaster33: Dec 28, 2002, 5:24 AM
Quote Reply
Re: [ManuGermany] Include cgi-output from outside LinksSQL In reply to
Hi,

You could use:

<%LWP::Simple::get('http://www.yahoo.com')%>

or

<%GT::URI::HTTP::get('http://www.yahoo.com')%>

as a template tag and that will fetch that URL and put the output in your template. Anything more tricky will require a global and some code.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Include cgi-output from outside LinksSQL In reply to
I have been trying to get a cgi file out put onto my home page from Links, and neither method above reurns anything at all...

I used:

<%LWP::Simple::get('http://www.bcdb.com/bcdb/xml-fetch.cgi')%>

and

<%GT::URI::HTTP::get('http://www.bcdb.com/bcdb/xml-fetch.cgi')%>

and there is absolutely nothing returned.... no error, either, so I guess that part is good!

The script does work- you can call it directly. It outputs a table of the last 5 posts to my GT Forum.

Any ideas?

Thanks!
dave

Big Cartoon DataBase
Big Comic Book DataBase
Quote Reply
Re: [carfac] Include cgi-output from outside LinksSQL In reply to
Check your error log just incase something is being written to it.
Quote Reply
Re: [Paul] Include cgi-output from outside LinksSQL In reply to
Paul:

OK, can I just say I am an idiot???? Thanks! (I have lwp-trivial/1.35 as a UA banned, and that seems to have caused the error!)Blush
dave

Big Cartoon DataBase
Big Comic Book DataBase
Quote Reply
Re: [carfac] Include cgi-output from outside LinksSQL In reply to
Hehe Wink
Quote Reply
Re: [Alex] Include cgi-output from outside LinksSQL In reply to
Hi.

Is there a way to get over the problems of relative links on the page/output that is being included? All the images/links as relative links are gone or non functional. I tried this in GM though ....

Thnx

Anup