Gossamer Forum
Home : Products : Links 2.0 : Discussions :

newest entry to front?

Quote Reply
newest entry to front?
Hi - how do I get new links that have been validated and added to a category to appear on the top of the first page?

At the moment mine seems to put the latest entries in the bottom of the last page.
Quote Reply
Re: [davidarthurs2] newest entry to front? In reply to
You sure? Has isNew been set to 'Yes' for those records?

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] newest entry to front? In reply to
where would i make that change? is it in links.def?
Quote Reply
Re: [davidarthurs2] newest entry to front? In reply to
it should be done automatically, and a new link will be so-listed fo the time period defined in links.cfg, with a default setting of 14 days. To verify/change the setting, go through the admin, under links, modify. There will be a drop-down with the option of yes/no for isNew. Links normally sorts alphabetically, but places new links (tagged as such) before older ones. Have you made any changes to the code?


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] newest entry to front? In reply to
i have modified entry as 'new' and it still appears as the last entry. my entries don't seem to be alpabetical but by date with the most recent on the last page, rather than the first.


the only other thing i tried was this which was suggested before, but i got no response -

http://www.gossamer-threads.com/perl/gforum/gforum.cgi?post=249938;search_string=arthurdavid;#249938

i have been trying to get this fixed for over a year so it would be great if you could help.
Quote Reply
Re: [davidarthurs2] newest entry to front? In reply to
You posted previously about having a date problem (http://www.gossamer-threads.com/...i?post=176622#176622). Did you resolve this? Seems likely your current problem is related to this date issue.


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] newest entry to front? In reply to
that was fixed.

my problem is that older entried are first as you can see here -
http://www.creativeireland.com/jobdesk/pages/jobs_wanted/graphics/index.shtml

hope you can help, if you need me to post a certain part of links.cfg or links.def I can...
Quote Reply
Re: [davidarthurs2] newest entry to front? In reply to
if anyone could help i'd greatly appreciate it!
Quote Reply
Re: [davidarthurs2] newest entry to front? In reply to
anyone know what parts of links.cfg I should change to get the newest links entries to the top of the first page?
Quote Reply
Re: [davidarthurs2] newest entry to front? In reply to
Have you made any changes to db_utils.pl? The sub_build_sorthit determines how the links are sorted. Here is the stock code, compare to what you have:

sub build_sorthit {
# --------------------------------------------------------
# This function sorts a list of links. It has been modified to sort
# new links first, then cool links, then the rest alphabetically. By modifying
# the sort function below, you can sort the links however you like (by date,
# or random, etc.).
#
my (@unsorted) = @_;
my ($num) = ($#unsorted+1) / ($#db_cols+1);
my (%sortby, %isnew, %iscool, $hit, $i, @sorted);

for ($i = 0; $i < $num; $i++) {
$sortby{$i} = $unsorted[$db_sort_links + ($i * ($#db_cols+1))];
($unsorted[$db_isnew + ($i * ($#db_cols+1))] eq "Yes") and ($isnew{$i} = 1);
($unsorted[$db_ispop + ($i * ($#db_cols+1))] eq "Yes") and ($iscool{$i} = 1);
}
foreach $hit (sort {
($isnew{$b} and !$isnew{$a}) and return 1;
($isnew{$a} and !$isnew{$b}) and return -1;
($iscool{$b} and !$iscool{$a}) and return 1;
($iscool{$a} and !$iscool{$b}) and return -1;
($isnew{$a} and $isnew{$b}) and return lc($sortby{$a}) cmp lc($sortby{$b});
($iscool{$a} and $iscool{$b}) and return lc($sortby{$a}) cmp lc($sortby{$b});
return lc($sortby{$a}) cmp lc($sortby{$b});
} (keys %sortby)) {
$first = ($hit * $#db_cols) + $hit;
$last = ($hit * $#db_cols) + $#db_cols + $hit;
push (@sorted, @unsorted[$first .. $last]);
}
return @sorted;
}


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] newest entry to front? In reply to
This is what I have (seems to be the same!) :

sub build_sorthit {
# --------------------------------------------------------
# This function sorts a list of links. It has been modified to sort
# new links first, then cool links, then the rest alphabetically. By modifying
# the sort function below, you can sort the links however you like (by date,
# or random, etc.).
#
my (@unsorted) = @_;
my ($num) = ($#unsorted+1) / ($#db_cols+1);
my (%sortby, %isnew, %iscool, $hit, $i, @sorted);

for ($i = 0; $i < $num; $i++) {
$sortby{$i} = $unsorted[$db_sort_links + ($i * ($#db_cols+1))];
($unsorted[$db_isnew + ($i * ($#db_cols+1))] eq "Yes") and ($isnew{$i} = 1);
($unsorted[$db_ispop + ($i * ($#db_cols+1))] eq "Yes") and ($iscool{$i} = 1);
}
foreach $hit (sort {
($isnew{$b} and !$isnew{$a}) and return 1;
($isnew{$a} and !$isnew{$b}) and return -1;
($iscool{$b} and !$iscool{$a}) and return 1;
($iscool{$a} and !$iscool{$b}) and return -1;
($isnew{$a} and $isnew{$b}) and return lc($sortby{$a}) cmp lc($sortby{$b});
($iscool{$a} and $iscool{$b}) and return lc($sortby{$a}) cmp lc($sortby{$b});
return lc($sortby{$a}) cmp lc($sortby{$b});
} (keys %sortby)) {
$first = ($hit * $#db_cols) + $hit;
$last = ($hit * $#db_cols) + $#db_cols + $hit;
push (@sorted, @unsorted[$first .. $last]);
}
return @sorted;
}
Quote Reply
Re: [davidarthurs2] newest entry to front? In reply to
any one know wher eyou specify getting the newest links entries to the top of first page??