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

Plugin help needed for Prev & Next quickjump plugin!

Quote Reply
Plugin help needed for Prev & Next quickjump plugin!
Sorry for posting this here, but the plugin category is not watched very often.
I started to write a plugin, which will be able to place previous & next links (anchors) for each link, so the user can easily jump forward & back. That's the background story.

The solution:
The list of links on the current page is needed, to get the prev & next link id. The only possible place, where we get raw link data from DB is Build.pm/sub build_category.
Therefore I have to use GT::Plugins->action ( STOP ); to ignore the original code of build_category, and run the copy of build_category built into my plugin.

So we have a build_category sub in the plugin file, which has almost the same some as the original build_category had (just corrected some sub call like 'build' to 'Links::Build::build' to find them).
Now I add the <%num%> to be $link key list, so <%num%> can be displayed:
Code:
my $nr=1; # added here
foreach my $link (@$results) {
$link->{'num'} = $nr++; # added here
$link->{Category_Template} = $category->{Category_Template}
if ($category->{Category_Template});
$display{links} .= Links::SiteHTML::display ('link', $link);
push @{$display{links_loop}}, $link;
}

Modification is highlighted in Red. Nothing else was modified.
Now the <%num%> tag should be available, when displaying a category page with page.cgi, but NO, it's not available (result: unknown tag: 'num').

I did a dump of $link using Data::Dumper.
It displayed the $link array of hashes list, 2 times:
- 1. time the 'num' key was displayed in the list, as we wanted,
- 2. time the 'num' key was NOT displayed.

This means, that the 2. step overwrites the values of $link, what we got in 1. step with the values of 2. The 2. step is not expected to be at all. I tested it, the 2. executed step is the original build_category code (which should NOT be executed, because we used the GT::Plugins->action ( STOP ); to ignore it).


I know this is a difficult problem (maybe a bug, but maybe I did something wrong), but I hope some professionals will understand it, and find a solution for this.

I wait answer mainly from Alex (he would know what I'm talking about), but any help or idea is appreciated, if somebody knows plugins.


Thanks in advance,

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...
Subject Author Views Date
Thread Plugin help needed for Prev & Next quickjump plugin! webmaster33 4727 Feb 15, 2002, 12:16 PM
Thread Re: [webmaster33] Plugin help needed for Prev & Next quickjump plugin!
pugdog 4626 Feb 15, 2002, 1:15 PM
Thread Re: [pugdog] Plugin help needed for Prev & Next quickjump plugin!
webmaster33 4586 Feb 15, 2002, 1:22 PM
Post Re: [webmaster33] Plugin help needed for Prev & Next quickjump plugin!
pugdog 4589 Feb 16, 2002, 1:30 AM
Thread Re: [pugdog] Plugin help needed for Prev & Next quickjump plugin!
webmaster33 4629 Feb 16, 2002, 1:24 AM
Thread Re: [webmaster33] Plugin help needed for Prev & Next quickjump plugin!
pugdog 4590 Feb 16, 2002, 1:48 AM
Thread Re: [pugdog] Plugin help needed for Prev & Next quickjump plugin!
webmaster33 4570 Feb 16, 2002, 1:58 AM
Thread Re: [webmaster33] Plugin help needed for Prev & Next quickjump plugin!
pugdog 4578 Feb 16, 2002, 7:32 AM
Thread Re: [pugdog] Plugin help needed for Prev & Next quickjump plugin!
pugdog 4557 Feb 16, 2002, 7:39 AM
Post Re: [pugdog] Plugin help needed for Prev & Next quickjump plugin!
webmaster33 4556 Feb 16, 2002, 10:34 AM