Help sorting Recent Entries descending order

Creating and modifying plugins.
digitalfilm
Regular
Posts: 40
Joined: Wed Feb 07, 2007 8:04 pm
Location: New York City
Contact:

Help sorting Recent Entries descending order

Post by digitalfilm »

Using the plug in "recent entries" I am unable to find a way to sort by descending order... most recent first.

I read the thread on doing this with a single category, but not for all categories. Is there something I missed?

Thank you
Mark

http://5in500.com
Five Hundred People One Question
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Help sorting Recent Entries descending order

Post by garvinhicking »

Hi!

The recent entries plugin does sort the most recent first, and older bottom. In the PHP sourcecode it's "ORDER BY timestamp DESC". You cannot configure this currently, but this should already be what you're searching for?

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
digitalfilm
Regular
Posts: 40
Joined: Wed Feb 07, 2007 8:04 pm
Location: New York City
Contact:

for some reason it sorts ASC

Post by digitalfilm »

If you look at http://group8020.com in the right hand column you will see that it is sorting with the oldest entries on top, newest on the bottom. Perhaps I am misunderstanding something?

Thanks for the assistance!
Mark

http://5in500.com
Five Hundred People One Question
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: for some reason it sorts ASC

Post by garvinhicking »

Hi!

Uh, that's really strange. Could you check the file plugins/serendipity_plugin_recententries/serendipity_plugin_recententries.php and look for "ORDER BY" - and tell if if it reads 'ASC' or 'DESC' for you?

You could try to change that to read 'DESC' or 'ASC' (the opposite of what you'Re using now). But I'd be confused if it currently reads 'asc'...?!?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
digitalfilm
Regular
Posts: 40
Joined: Wed Feb 07, 2007 8:04 pm
Location: New York City
Contact:

Plugin indicates sort by DESC

Post by digitalfilm »

I checked the php file and it says:
--------------------------------------------------

$entries_query = "SELECT DISTINCT id,
title,
timestamp
FROM {$serendipity['dbPrefix']}entries
$sql_join
WHERE isdraft = 'false' AND timestamp <= " . time() . "
$sql_where
ORDER BY timestamp DESC
$sql_number";
$entries = serendipity_db_query($entries_query);
--------------------------------------------------

I had also tried changing the sort order with the category properties template per a previous posting here on the board prior to asking for help but it also had no effect.

Should I try remove and then reinstalling the plugin?
Mark

http://5in500.com
Five Hundred People One Question
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Plugin indicates sort by DESC

Post by garvinhicking »

Hi!

What happens if in that plugin you change it to "ORDER BY timestamp ASC"?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
digitalfilm
Regular
Posts: 40
Joined: Wed Feb 07, 2007 8:04 pm
Location: New York City
Contact:

nothing changed

Post by digitalfilm »

interestingly enough, nothing changed which seemed odd.
Mark

http://5in500.com
Five Hundred People One Question
digitalfilm
Regular
Posts: 40
Joined: Wed Feb 07, 2007 8:04 pm
Location: New York City
Contact:

hmm, spartacus seems unhappy

Post by digitalfilm »

don't know if this helps or not, but when i deleted the plugin from the admin console and removed it from my server via ftp i went to reinstall it and got the message that zero bytes are being retrieved:

Trying to open URL package_sidebar_en.xml...
Fetched 0 bytes from the URL above. Saving file as /home/server/pathl/blog/templates_c/package_sidebar_en.xml...
Data successfully fetched.
Mark

http://5in500.com
Five Hundred People One Question
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: hmm, spartacus seems unhappy

Post by garvinhicking »

Hi!

Which Mirror did you set in the spartacus plugin?

Try to delete the mentioned .xml file, then spartacus will try to re-fetch it.

If the sort order didn't change after you changed the plugin php code, this should mean that you did not edit the plugin'S file that's actually active? Maybe you had a second copy lieing on the server somehow?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
antoniolite
Posts: 4
Joined: Sat Mar 10, 2007 2:20 pm
Location: Spain
Contact:

Post by antoniolite »

Hi,

I have the same problem in www.casarusia.com, i tried everthing but the recent entries still shows from oldest to newer.

maybe it is a x-file?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi antoniolite!

Which changes did you try exactly? Which file did you edit?

You could try to add some random "echo 'Tst!';" to the generate_content function of that file to see if the file you are editing is actually the right one and shows the changes?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
antoniolite
Posts: 4
Joined: Sat Mar 10, 2007 2:20 pm
Location: Spain
Contact:

Post by antoniolite »

Hello,

i added a "echo $entries_query;" after construct the select query, and this is what i got:

Code: Select all

SELECT DISTINCT id, title, timestamp FROM s9y_entries WHERE isdraft = 'false' AND timestamp <= 1175942543 ORDER BY timestamp DESC LIMIT 10
Looks right, but i continue getting recent entries from older to newer :?

Regards
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

If you execute that SQL query in phpmyadmin, is it still the wrong order? What happens if you replace "DESC" with "ASC"?

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
antoniolite
Posts: 4
Joined: Sat Mar 10, 2007 2:20 pm
Location: Spain
Contact:

Post by antoniolite »

Very strange...

if i execute the query in phpmyadmin, i get the same result... with ASC and DESC...

I changed the query to:

Code: Select all

SELECT * FROM s9y_entries WHERE isdraft = 'false' ORDER BY id DESC LIMIT 10;
and looks like now i get the recent entries correctly. Is not a good solution, but it works :roll:
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

How about using this Query:

Code: Select all

SELECT DISTINCT id, title, `timestamp` FROM s9y_entries WHERE isdraft = 'false' AND timestamp <= 1175942543 ORDER BY `timestamp` DESC LIMIT 10
Maybe the reserved word 'timestamp' is somehow wrongly evaluated...?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply