Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

jump.cgi to both the url AND detailed page

Quote Reply
jump.cgi to both the url AND detailed page
Hi Everyone,

I want the jump.cgi to open the link URL in the same window and the detailed page in a new window. I currently accomplish this by adding this code to the top of the include_common_head.html template:
Code:

<SCRIPT LANGUAGE="JavaScript">
function DOpen(site1, site2) {
window.open(site1);
window.location = site2;
}
</script>

and then in the link.html template I use this code:
Code:
<a href="javascript:DOpen('<%build_root_url%>/Detailed/<%ID%>.html', '<%db_cgi_url%>/jump.cgi?ID=<%ID%>');"><%Title%></a>

Now, this works just fine for the most part when a user is on my site, but if a user recommends a link either through email or a social media recommendation I use the detailed page (<%build_root_url%>/Detailed/<%ID%>.html), so the actual url does not open in the background as it does on my site, and the 'hit' is not counted.

What I would like to do is have the jump.cgi do all the work by opening the link URL in the same window and the detailed page in a new window, so when someone shares a link on social media or email I would send (<%db_cgi_url%>/jump.cgi?ID=<%ID%>) and it behaves the same way as it does on my site. Possibly by building the same code above into the jump.cgi.

(Not looking for a lecture on pop-ups, ect... LOL)

Thanks,

George
Quote Reply
Re: [macbethgr] jump.cgi to both the url AND detailed page In reply to
Is the purpose of doing this, purely to track page views? Or do you actually want to open the popup window? (that would be quick annoying for me, as a user :))

If you just want to log page views to the detailed page, and are using mod_rewrite - that wouldn't be hard to do with a global (let me know though, before I spend time writing it <G>)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] jump.cgi to both the url AND detailed page In reply to
Thanks Andy,

The way the JavaScript that I am currently using works is that the link opens and the detailed page opens in a new window (not a pop-up) over the link page, I need the jump.cgi to replicate this process. Just so I'm not "judged" for pop-ups (which I also hate), it is very necessary for my site because there is information in the detailed page that the user must have once the link is open, therefore the detailed page opens over the link page. I'm not looking for another way to do this, it is tried and true and my users appreciate it.

Thanks,
George
Quote Reply
Re: [macbethgr] jump.cgi to both the url AND detailed page In reply to
Ok np. So how about a simple script:

Code:
#!/usr/local/bin/perl

use strict;
use lib '/path/to/admin';
use Links qw/$IN $DB $CFG/;
use CGI::Carp qw(fatalsToBrowser);
local $SIG{__DIE__} = \&Links::fatal;

Links::init('/path/to/admin');

handle();

sub handle {
my $id = $IN->param('ID');
if ($DB->table("Links")->select( ['Title'], { ID => $id })->fetchrow) {

my $detailed_url = $CFG->{build_detail_url} . "/" . $DB->table('Links')->detailed_url( $id );
my $jump_url = "$CFG->{db_cgi_url}/jump.cgi?ID=$id";

print $IN->header;
print Links::SiteHTML::display('intermediary_jump', { detailed_url => $detailed_url, jump => $jump_url });

} else {
print $IN->header;
print Links::Site HTML::display('error', { error => qq|Cant find link| });
}
}

Then make a new template (intermediary_jump.html), where you work with the <%detailed_url%> and <%jump_url%> params. You can do whatever you want then (open the new window + then redirect to the detailed page, or whatever)

Hope that helps

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] jump.cgi to both the url AND detailed page In reply to
Andy,

Interesting.... I'll give it a try!

Thanks,
George