You could use a global, similar to the below (untested);
use Links::Plugins;
# no point doing anything if we dont hae a username...
if (!$USER->{Username}) { return; }
my $opts = Links::Plugins->get_plugin_user_cfg('MyFaves');
my $per_page = $opts->{LinksPerPage} || 25;
my $save_type= $opts->{SaveType} || 'c';
if ($save_type eq "c") {
# grab the old list of ID's...
my $cut_up = $IN->cookie('IDList');
# now explode the list, so we can check this ID doesn't already exist...
my @sliced = split(/ /, $cut_up);
my $count = 0;
# count the links....
foreach (@sliced) {
$count++;
}
return $count;
} else {
return $DB->table('MyFaves')->count( { Username => $USER->{Username} } ) || 0;
}
}
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!
Code:
sub { use Links::Plugins;
# no point doing anything if we dont hae a username...
if (!$USER->{Username}) { return; }
my $opts = Links::Plugins->get_plugin_user_cfg('MyFaves');
my $per_page = $opts->{LinksPerPage} || 25;
my $save_type= $opts->{SaveType} || 'c';
if ($save_type eq "c") {
# grab the old list of ID's...
my $cut_up = $IN->cookie('IDList');
# now explode the list, so we can check this ID doesn't already exist...
my @sliced = split(/ /, $cut_up);
my $count = 0;
# count the links....
foreach (@sliced) {
$count++;
}
return $count;
} else {
return $DB->table('MyFaves')->count( { Username => $USER->{Username} } ) || 0;
}
}
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!