Hi,
If you know the LINK_ID of the link you want popular, you can make a small change to the code.
Do you use static, or dynamic sites? The process is a bit different for each.
For static sites, you can edit Build.pm, and in the subroutine build_cool_flags you can change:
Code:
while ( ($id, $hits, $ispop) = $sth->fetchrow_array) {
push @ids, $id;
next if ($ispop eq 'Yes');
$link_db->update ( { isPopular => 'Yes' }, { ID => $id }, { GT_SQL_SKIP_CHECK => 1 } );
$changed++;
}
to
Code:
while ( ($id, $hits, $ispop) = $sth->fetchrow_array) {
push @ids, $id;
next if ($ispop eq 'Yes');
$link_db->update ( { isPopular => 'Yes' }, { ID => $id }, { GT_SQL_SKIP_CHECK => 1 } );
$changed++;
}
my @keep_popular_list = (list,of,ids,to,make,or,keep,popular); ## for clarity
push @ids , @keep_popular_list;
What this does, is push the ID's onto $ids, which prevents them from being reset to "isPopular = No" a few lines down. It does *NOT* set any links to popular (you'll have to do that yourself in the admin).
You could probably add:
Code:
foreach my $keep_popular_ID (#keep_popular_list) {
$link_db->update ( { isPopular => 'Yes' }, { ID => $keep_popular_ID }, { GT_SQL_SKIP_CHECK => 1 } );
} after the last line to actually set the keep_popular links to "pop" in case something resets them for some reason.
If you want to keep the limit you set in your config, a bit higher up you'll need to change
$limit = int $limit || 1;
to be
#$limit = int $limit || 1;
$limit = 15 ; ## or whatever value you want to show, MINUS the number of "Keep Popular" links.
So, if you want 20 total popular links, and have 7 keep-popular links, your $limit needs to be set to 13.
Yes, this is a quick/dirty hack, that should work for static sites, since this routine is called before the pages are built.
Dynamic sites have a different set of problems.
While this is a code edit that won't survive an upgrade, it also won't break an upgrade, and you can always add it back. Creating a plugin, or such, is a lot more code, and sort of like hitting a fly with a slege hammer. Sometimes, code edits are _good_ ;)
PUGDOG� Enterprises, Inc. The best way to contact me is to
NOT use Email.
Please leave a PM here.