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

Minor jump.cgi mod for internal jumps

Quote Reply
Minor jump.cgi mod for internal jumps
If you've wanted to jump to local pages, and you have some scripts that can't be easily edited to use <%if%> etc in the templates, you can edit the bottom of jump.pm to be:

Code:

($goto =~ m,^\w+://,) or ($goto = "http://$goto");
if ($goto eq 'http://' ) {
print $IN->redirect ("$CFG->{'db_cgi_url'}/detail_page.cgi?ID=$id" );
} elsif ($goto){
print $IN->redirect ($goto);
}
else {


What you do is change the ending if/else construct to add the elsif, and put the first test for the null "http://" or whatever you use.

That way, if jump.cgi is called, and the URL is just an internal reference, with a detail page, or long description, the call won't return an error.

If your scripts use the template parser, you can do the test in the templates, but I've hit a few cases where hard coding this behaviour saves a lot of editing templates.

And, if you eventually edit the templates, no foul, or harm done.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] Minor jump.cgi mod for internal jumps In reply to
I realize that this is an old thread but I am doing a new installation where all links are internal and require jump.cgi to redirect to the Detailed page. I also need to know what info I need to set as default in the URL field on the Add page to accomplish this.
Quote Reply
Re: [MJB] Minor jump.cgi mod for internal jumps In reply to
Hi,

I just use this;

jump.cgi?ID=1234;detailed=1

(I think that works)

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] Minor jump.cgi mod for internal jumps In reply to
So I take it you add that to the link.html template?

What happens with the URL field when I add a link? Do I need to make this hidden and give it a default value?
Quote Reply
Re: [MJB] Minor jump.cgi mod for internal jumps In reply to
Hi,

Yeah, just change instances of:

Code:
<%config.db_cgi_url%>/jump.cgi?ID=<%ID%>

..to:

Code:
<%config.db_cgi_url%>/jump.cgi?ID=<%ID%>;detailed=1

Regarding URL, just remove it from the include_form.html, and add this line (so it has a default value):

Code:
<input type"hidden" name="URL" value="http://" />

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] Minor jump.cgi mod for internal jumps In reply to
Will it still log hits?

I've tried a test addition in dynamic mode but the hits count remains a 0.
Quote Reply
Re: [MJB] Minor jump.cgi mod for internal jumps In reply to
Hi,

Actually, it should be:

Code:
jump.cgi?Detailed=<%ID%>

Also, yes - it will track hits (just tested it on a local install).

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] Minor jump.cgi mod for internal jumps In reply to
Right, got it now.

Because Detailed was enabled it was going straight the detailed url and bypassing the jump.cgi. I have change <%if detailed_url and isValidated eq 'Yes'%> from <%detailed_url%> to <%config.db_cgi_url%>/jump.cgi?Detailed=<%ID%> and it's working now.

Thanks Andy.
Quote Reply
Re: [MJB] Minor jump.cgi mod for internal jumps In reply to
NP, glad its working Cool

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] Minor jump.cgi mod for internal jumps In reply to
A follow up to this post since implementing this feature.

I now notice that visitors entering the site from search engine results are landing on the Detailed pages. This obviously bypasses the jump.cgi link so having Hits displayed is pretty pointless.

3 questions:
  1. Is there any way to register a direct hit to the Detailed pages (e.g. rewrite rule through the jump.cgi or something)?

  2. Does this have any effect on the Cool page list?

  3. What data is used to compiled the Cool page?

Quote Reply
Re: [MJB] Minor jump.cgi mod for internal jumps In reply to
If using mod_rewrite to serve up your detailed pages, just have a global like (in detailed.html):

track_hit
Code:
sub {
$DB->table('Links')->update( { Hits => \"Hits + 1" }, { ID => $_[0] } );
return;
}

Then call with

<%track_hit($ID)%>

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] Minor jump.cgi mod for internal jumps In reply to
Well that works perfectly in dynamic mode.

I have just rebuilt the pages and will see if it works in static. Fingers crossed.

Thanks Andy. :)
Quote Reply
Re: [MJB] Minor jump.cgi mod for internal jumps In reply to
Hi,

I'm afraid it won't work in static =)

Just setup detailed pages with mod_rewrite - something like:

RewriteRule Detailed/(.*)$ /cgi-bin/links/page.cgi?g=Detailed/$1 [L]

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] Minor jump.cgi mod for internal jumps In reply to
Got it.

I just added that line to the .htaccess file, tested it on a static page and the count now increments.

Thanks again. :)
Quote Reply
Re: [MJB] Minor jump.cgi mod for internal jumps In reply to
Np - glad it works :)

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!