Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Jump.cgi to Open in a Frame

Quote Reply
Jump.cgi to Open in a Frame
Hello,

I was wondering if anyone here has successfully coded Links 2.0 so that when you use jump.cgi to go to another site it opens a frame with the site and possibly your banner or rating options in the top of the frame like this does:

http://links.paintballcity.net/jump.cgi?ID=1371

Thanks for your time.

P a i n t b a l l C i t y . c o m
http://www.paintballcity.com
Quote Reply
Re: Jump.cgi to Open in a Frame In reply to
I am also very keen on this. Having a look at jump.cgi i am finding it very difficult to understand even what is going on. Anyway, i think this is the section to change?

# Redirect to a detailed page if requested.
if ($CFG->{build_detailed} and $IN->param('Detailed')) {
$goto = $CFG->{build_detail_url} . '/' . $id . $CFG->{build_index};
}
($goto =~ m,^(https?|ftp|mailto|news)://,) or ($goto = "http://$goto");
if ($goto) {
print $IN->redirect ($goto);
}
else {
print $IN->header();
print Links::SiteHTML::display ('error', { error => Links::language ('JUMP_INVALIDID', $id) });
return;
}
}

now i think it is this section i need to change:
($goto =~ m,^(https?|ftp|mailto|news)://,) or ($goto = "http://$goto");

(is that saying, check for https/ftp/mailto/news and if not add http:// to goto?)

If that is the case then i would think i just add another line making it a frameset code. So the next question is how can i get the extra frames i open up to have access to the link variables? so you could have, for example, a link to deadlink.cgi on the frame opened.

Help really appreciated if possible!



http://www.ASciFi.com/ - The Science Fiction Portal
Quote Reply
Re: Jump.cgi to Open in a Frame In reply to
I don't have a technical solution to your question, I just want you to know that framing someone's site might be a copyright violation.
For example, if you have a category called "news" including a link to cnn.com, and when a visitor clicks on the link cnn.com loads in a frame while you serve a banner to the visitor, CNN might come after you for copyright violations (it has happened before).

- Didi Melchior
http://Mishpat.Net - Internet Legal Information

Quote Reply
Re: Jump.cgi to Open in a Frame In reply to
i am not serving a banner and i believe that this is only an issue if you claim ownership. If about.com does it then i can.

http://www.ASciFi.com/ - The Science Fiction Portal
Quote Reply
Re: Jump.cgi to Open in a Frame In reply to
Ok, i have done the easy bit i think:

This is the bottom of my jump.cgi. It contains all the changes:

# Redirect to a detailed page if requested.
if ($CFG->{build_detailed} and $IN->param('Detailed')) {
$goto = $CFG->{build_detail_url} . '/' . $id . $CFG->{build_index};
}
($goto =~ m,^(https?|ftp|mailto|news)://,) or ($goto = "http://$goto");
if ($goto) {

# line removed for jump with framset
# print $IN->redirect ($goto);

# start of section added for jump in framset

print "Content-type: text/html\n\n";
print qq~<html>
<head>
<title></title>
</head>

<frameset rows="80,*" cols="*" frameborder="NO" border="0" framespacing="0">
<frame src="http://www.ascifi.com/header.html" marginwidth="10" marginheight="10" scrolling="no" frameborder="no" resize="no">
<frame src="$goto">
</frameset>
<noframes>
No frames stuff goes here
</noframes>
<body>
</body>
</html>~;

# end of addition for jump in framset.

}
else {
print $IN->header();
print Links::SiteHTML::display ('error', { error => Links::language ('JUMP_INVALIDID', $id) });
return;
}
}

basically you need to comment out one line and add the section.

At the moment this just adds a frame at the top. I want to make this a template at the top with access to link variables but need help on this.

Have not cheked if this causes problems with random links or detailed but i don't think it will.

http://www.ASciFi.com/ - The Science Fiction Portal
Quote Reply
Re: Jump.cgi to Open in a Frame In reply to
ok i think i have found ***a way*** to do this.

I made a script called frame.cgi containing:

#!/usr/bin/perl
# ==============================================================
#
# Jump in framset
# Thanks to pugdog for most of this code.
# ==============================================================

# Load required modules.
# ---------------------------------------------------
use strict;
use lib '/home/ascifi/www/dir/admin'; ## you need to set this to your own local path!
use Links qw/$DB $IN $USER $CFG/; ## initialize the Database, CGI and other basic objects.
use Links::SiteHTML;
use Links::Authenticate;
use Links::Plugins;
# use GT::Mail;
# use GT::Plugins qw/STOP CONTINUE/;
use vars qw/$BAD_LINK_CFG/;
$|++;

&main();

sub main {

# Define the variables
# ---------------------------------------------------
my ($id, $db_links, $rec);

# Get the Links ID number from the input.
$id = $IN->param('ID');

## check to see if an ID was submitted and that it was numeric
if (!(defined $id) or !($id =~ /^\d+$/)) {
print $IN->header();
print Links::SiteHTML::display('error', {error => "Invalid id: $id"});
return;
}

## Check to see if the ID/Link record exists

$db_links = $DB->table('Links'); ## first grab a new db handle

$rec = $db_links->get ($id); ## see if the ID record exists

if (! $rec) { ## handle errors
print $IN->header();
print Links::SiteHTML::display ('error', { error => Links::language ('JUMP_INVALIDID', $id) });
return;
}


print $IN->header();
print Links::SiteHTML::display ('bad_link', $rec );
return;



} ## end of main


(all completly stolen from one of pugdogs script)

and then made a template called frameset.html and it seems to work.

Just change the link that was ascifi.com/header or something to

www.path.to/frame.cgi?ID=$id

and you are done.

=================

I am sure this is not a "nice" way of doing this but i am rubbish at perl and all i know is it works. I would be grateful for suggestions to make it better though.

thanks

http://www.ASciFi.com/ - The Science Fiction Portal
Quote Reply
Re: Jump.cgi to Open in a Frame In reply to
There are some of the big guys who do it (Ask Jeeves) but that does not make it legitimate.

The question is not wether you serve a banner, or just have a navigation bar that lets you keep the visitors (which in a sense is also a revenue generating tactic), it might be infringment even if you have no financial gain.

The real question is if you fall within the "fair use" doctrine (and this varies from country to country). There are several componants to "fair use" and financial gain is just one of them.

This is a complicated issue, I just didn't want anyone getting into trouble for not, at least, being aware of the problem Smile

- Didi
http://Mishpat.Net - Internet Legal Information

Quote Reply
Re: Jump.cgi to Open in a Frame In reply to
Cool ideas, what I do is the following:
make a duplicate of detail_page.cgi
make a detail page as frameset like this:


<head>
<title></title>
</head>

<frameset rows="80,*" cols="*" frameborder="NO" border="0" framespacing="0">
<frame src="http://www.yourpathto.com/header.html" marginwidth="10" marginheight="10" scrolling="no" frameborder="no" resize="no">
<frame src="jump.cgi?ID=<%ID%>">
</frameset>
<noframes>
No frames stuff goes here
</noframes>
<body>
</body>
</html>

I think, this should be the easiest way to do something like that.



Quote Reply
Re: Jump.cgi to Open in a Frame In reply to
I'm sorry I haven't had a chance to really look at this for you!

I'll bump this up a few notches for my down time, since I think this should be mostly an HTML/template thing, not a perl thing.



PUGDOGŪ Enterprises, Inc.
FAQ:http://LinkSQL.com/FAQ
Forum:http://LinkSQL.com/forum
Quote Reply
Re: Jump.cgi to Open in a Frame In reply to
There is a free cgi-perl script which do the work. The name is FrameIt , can be found at cgi-resources.com
It is long ago that I have used it . But you call frameit.cgi + the link you want . Than it opens a page with a frame where you can add what you want and a frame for the content of the link.

Edit Link.html something like http://www.yourdomain.com/cgi-bin/framit.cgi?http://www.yourdomain.com/cgi-bin/linkssql/jump.cgi?<%id%>

This is not the correct syntax but i would show how it works. For a correct use look at doc from frameIt.

Hope I could help you.

Quote Reply
Re: Jump.cgi to Open in a Frame In reply to
frameit istn't really any use because the second frame you open does would not have the link variables. The bit the frameit does can be done with about 5 lines of code in jump.cgi (my first code posting). It is the second bit that is harder. I managed to do it with a perl script but as pugdog says i am sure there is an easier way (jerry su had one for links 2.0).

Pugdog no rush on this, it works for now but i know not the best way of doing it. Cheers.

http://www.ASciFi.com/ - The Science Fiction Portal
Quote Reply
Re: Jump.cgi to Open in a Frame In reply to
Actually, padders, you are on the right track...I am using similar codes in jump.cgi..for Links SQL v.1.13 though...

But the logic in your codes seems to be there and works...so that is the important thing.

Regards,

Eliot Lee
Quote Reply
Re: Jump.cgi to Open in a Frame In reply to
thanks! my first mod for links sql ;)

i think it could be done with page.cgi and a template global but don't know if that would be that much more efficient.

http://www.ASciFi.com/ - The Science Fiction Portal