Gossamer Forum
Home : Products : Links 2.0 : Discussions :

Return Frame for links

Quote Reply
Return Frame for links
Is there a modifcation already written to allow a frame with "Return to Mysite.com" "Remove This Frame."

I didn't see one here. I know there are redirect scripts and have looked at some at the CGI Resource Index but I'd rather find one that someone wrote specifically to work with Links.
Quote Reply
Re: Return Frame for links In reply to
Uh...there is a lengthy Topic in the MODIFICATION FORUM that discusses how to modify the jump.cgi file to do this....

Search for "frameset jump" in the MODIFICATION FORUM.

I have this code hack working in my site:

Go to:

vlib.anthrotech.com

Click on one of the New Links in the Site Updates section towards the bottom of the page.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: Return Frame for links In reply to
I made those changes and still just an empty browser window. In the original thread from way back that widgetz posted he showed two options. One modify the various templates and the other was to use the rate templates and simply modify them.

I chose to modify to rate templates because that seemed the most straight forward.

So, I know I'm in way over my head in all this but it seems that if the frames are showing up in the source code of the page AND I'm not getting an error message, well, at least I should see something.

Source Code for Sample Page


<html>
<head><title>Abilene Christian University</title></head>
<body>
<frameset rows="70,*">
<frame name="top" src="http://churchfun.com/cgi-bin/links/jump.cgi?ID=3&display=1" marginwidth="10" marginheight="10" scrolling="no" frameborder="no">
<frame name="bottom" src="http://www.acu.edu" marginwidth="10" marginheight="10" scrolling="auto" frameborder="no">
</frameset>
</body>
</html>


As you can see, the new code you suggested did make it all the way to the browser but no pages are visible.

After I see something and know that the frames are working I'll go back and tweak the top frame.

One more thing to consider. Mine is a FrontPage 2000 site. I had to jump through some hoops just to get the html pages working because of FP2000. Could that be the reason for this problem?



[This message has been edited by Curt (edited March 16, 2000).]
Quote Reply
Re: Return Frame for links In reply to
Possibly...(with regards to the FP 2000 issue).

Quote:
I chose to modify to rate templates because that seemed the most straight forward.

Hmm...that could be your problem.

If you REALLY did follow the suggested changes I suggested, then it should work.

Regards,



------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: Return Frame for links In reply to
Okay I've spend hours looking at the good work Eliot & Jerry did.

Here what I have. After doing what I think is the right modifications when I follow a link the page is simply blank.


=========================================
Here's what I have for my jump.cgi

#!/usr/local/bin/perl
# -------------
# Links
# -------------
# Links Manager
#
# File: jump.cgi
# Description: Increments the number of hits for the specified link,
# and sends the user off to the appropriate page.
# Author: Alex Krohn
# Email: alex@gossamer-threads.com
# Web: http://www.gossamer-threads.com/
# Version: 2.0
#
# (c) 1998 Gossamer Threads Inc.
#
# This script is not freeware! Please read the README for full details
# on registration and terms of use.
# =====================================================================
#
# Form Input:
# '$db_key' = key number # Send as form input the key name and key value
# # of the link you want to go to.
#
# Setup:
# Make sure the require statement below points to the config file.

# Required Librariers
# --------------------------------------------------------
eval {
($0 =~ m,(.*)/[^/]+,) && unshift (@INC, "$1"); # Get the script location: UNIX /
($0 =~ m,(.*)\\[^\\]+,) && unshift (@INC, "$1"); # Get the script location: Windows \

require "admin/links.cfg"; # Change this to full path to links.cfg if you have problems.
require "$db_lib_path/db_utils.pl";
require "$db_lib_path/links.def";
#stuff I added
$build_use_templates ?
require "$db_lib_path/site_html_templates.pl" :
require "$db_lib_path/site_html.pl";
};
if ($@) {
print "Content-type: text/plain\n\n";
print "Error including libraries: $@\n";
print "Make sure they exist, permissions are set properly, and paths are set correctly.";
}

# ========================================================

eval { &main; }; # Trap any fatal errors so the program hopefully
if ($@) { &cgierr("fatal error: $@"); } # never produces that nasty 500 server error page.
exit; # There are only two exit calls in the script, here and in in &cgierr.

sub main {
# --------------------------------------------------------
my %in = &parse_form();
my ($goto, $id, $delim, $time);

$id = $in{$db_key};
$delim = quotemeta($db_delim);
$time = time();

if ($id eq "random") {
my ($count, $rand, $find);

# Pull out the total number of links.
open (COUNT, "<$db_hits_path/index.count") or &error ("unable to open index count file: $db_hits_path/index.count. Reason: $!");
$count = int <COUNT>;
close COUNT;

# Get the random line from the url lookup database.
srand;
$find = 0; $rand = int (rand ($count + 0.5)); ($rand == $count) and ($rand--);
open (URL, "<$db_url_name") or &error ("unable to open url database: $db_url_name. Reason: $!");
while (<URL> ) {
$find++ == $rand or next;
/(\d+)$delim(.+)/o or next;
($id, $goto) = ($1, $2);
last;
}
close URL;
$goto or &error ("Can't find random line: $rand.");
}

# Stuff I added

elsif ($in{'display'}) {
my (%rec) = &get_record ($in{$db_key});
($rec{$db_key} eq $in{$db_key}) ?
&site_html_jump_display (%rec) :
&error ("Unkown Link ID: $in{$db_key}");
exit;
}
elsif (exists $in{$db_key}) {
# Make sure this is a valid looking id.
($id =~ /^\d+$/) or &error ("Invalid id: $id");

# Let's get the URL.
open (URL, "<$db_url_name") or &error ("unable to open url database: $db_url_name. Reason: $!");
while (<URL> ) {
(/^$id$delim(.+)/o) or next;
chomp ($goto = $1);
last;
}
close URL;
$goto or &error ("Can't find link id: $id");

# Bump the counter one.
if (open (HIT, "<$db_hits_path/$id")) {
my ($count, $old_time, @IP, $ip, $visited);
chomp ($count = <HIT> );
chomp ($old_time = <HIT> );
chomp (@IP = <HIT> );
(($time - $old_time) > 21600) and (@IP = ());
foreach $ip (@IP) {
$ip eq $ENV{'REMOTE_ADDR'} and ($visited++ and last);
}
if (!$visited) {
push (@IP, $ENV{'REMOTE_ADDR'});
$count = $count + 1;
open (HIT, ">$db_hits_path/$id") or &error ("Can't open for output counter file. Reason: $!");
if ($db_use_flock) { flock (HIT, 2) or &error ("Can't get file lock. Reason: $!"); }
local $" = "\n";
print HIT "$count\n$time\n@IP";
close HIT;
}
}
else {
open (HIT, ">$db_hits_path/$id") or &error ("Can't increment counter file. Reason: $!");
print HIT "1\n$time\n$ENV{'REMOTE_ADDR'}";
close HIT;
}
}
else {
&error ("No link specified!");
}

# Now let's send the user to the url..
($goto) or &error ("Record not found ($in{$db_key})");
my (%rec) = &get_record ($id);
print "Content-type: text/html\n\n";
print qq~<html>
<head><title>$rec{'Title'}</title></head>
<body>
<frameset rows="70,*">
<frame name="top" src="$build_rate_url?ID=$id" marginwidth="10" marginheight="10" scrolling="no" frameborder="no">
<frame name="bottom" src="$goto" marginwidth="10" marginheight="10" scrolling="auto" frameborder="no">
</frameset>
</body>
</html>~;
}

sub error {
# ------------------------------------------
#
print "Content-type: text/plain\n\n";
print "Error: $_[0]\n";
exit;
}


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

Here's the html source code for a sample page


<html>
<head><title>Abilene Christian University</title></head>
<body>
<frameset rows="70,*">
<frame name="top" src="http://churchfun.com/cgi-bin/links/rate.cgi?ID=3" marginwidth="10" marginheight="10" scrolling="no" frameborder="no">
<frame name="bottom" src="http://www.acu.edu" marginwidth="10" marginheight="10" scrolling="auto" frameborder="no">
</frameset>
</body>
</html>

I'm not getting any error messages at all. Just a blank browser window. I've tried it in Netscape and Internet Explorer.

I'm stumped.
Quote Reply
Re: Return Frame for links In reply to
It was Widgetz who wrote the bulk of the Mod...all I did was test it...

You need to replace the following codes:

Code:
<frame name="top" src="$build_rate_url?ID=$id" marginwidth="10" marginheight="10" scrolling="no" frameborder="no">

with the following codes:

Code:
<frame name="top" src="$build_jump_url?ID=$id&display=1" marginwidth="10" marginheight="10" scrolling="no" frameborder="no">

Then if you are using templates, you need to create a sub called sub site_html_jump_display.

This sub should look like the following:

Code:
sub site_html_jump_display {
#---------------------------------------------------------
# Top Frame for Jump.cgi

my (%rec) = @_;
&html_print_headers;
print &load_template ('jump_display.html', {
category => $category,
category_name => $category_name,
category_name_escaped => $catego
ry_name_escaped,
category_clean => $category_clea
n,
%rec,
%globals
});
}


Then create a new template file called jump_display.html. This should contain codes that you want to appear in the Rate Window. You can add your rate form in this page and also other links, like Removing Frames.

That should get you on the right track...and I would recommend re-reading that Topic for other steps that you need to follow to make this Mod work.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums