freetag plugin - related entries by tags in reverse order

Discussion corner for Developers of Serendipity.
Post Reply
costa
Regular
Posts: 110
Joined: Wed Feb 08, 2006 5:29 pm
Location: Poland
Contact:

freetag plugin - related entries by tags in reverse order

Post by costa »

aloha!

i just started using this great plugin having no idea, that tags are actually so helpfull. great stuff... one thing bothers me - printing of "related entries by tag". this is one hell good thing but it is showing entries from the oldest to the newest. i want to reverse this order - i want my latest entries related to given tags to be shown (is it in english? :)) prior to the older ones.

so maybe it would be a good idea to give such a possibility to user? another option maybe?
"everything is under control" - kasparov demo
jhermanns
Site Admin
Posts: 378
Joined: Tue Apr 01, 2003 11:28 pm
Location: Berlin, Germany
Contact:

Post by jhermanns »

this should really be an option! which plugin is displaying the related entries? the freetag plugin itself? i just had a quick glance, but i couldn't find it printed there :-)
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Actually I think it should always order descending; the opposite makes IMHO little sense. I just committed an update to the plugin to do that :)

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/
costa
Regular
Posts: 110
Joined: Wed Feb 08, 2006 5:29 pm
Location: Poland
Contact:

Post by costa »

hmm... i downloaded zipped plugin from cvs, in header of serendipity_event_freetag.php stands something like that:

Code: Select all

#$Id: serendipity_event_freetag.php,v 1.61 2006/06/19 08:55:03 garvinhicking Exp $
but to tell you the truth i don't see any difference. i have some entries tagged with exactly the same tags and it still shows oldest ones prior to the latest ones. where is the trick garv? :)

btw - i translated this plugin into polish.
"everything is under control" - kasparov demo
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi costa!

Maybe I made a bug. *g* I always mix up the "DESC" and "ASC" attributes.

Could you in your freetag.php file locate this:

Code: Select all

ORDER BY  e2.timestamp DESC
and replace it with:

Code: Select all

ORDER BY  e2.timestamp 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/
costa
Regular
Posts: 110
Joined: Wed Feb 08, 2006 5:29 pm
Location: Poland
Contact:

Post by costa »

some more tricks garvin? :)

ok, i can not find this phrase in both php files... this e2.timestamp thing bothers me at most because i can find it only once, in this query (i think it's query):

Code: Select all

        $q = "SELECT DISTINCT e1.entryid,
                     e2.title
                FROM {$serendipity['dbPrefix']}entrytags AS e1
           LEFT JOIN {$serendipity['dbPrefix']}entries   AS e2
                  ON e1.entryid = e2.id
               WHERE e1.tag IN ('" . implode("', '", $tags) . "')
                 AND e1.entryid != " . (int)$postID . "
                 AND e2.isdraft = 'false'
                     " . (!serendipity_db_bool($serendipity['showFutureEntries']) ? " AND e2.timestamp <= " . time() : '') . "
               LIMIT " . $this->get_config('show_related_count', 10);
so garvin, i want your file badly! seems that you have some unreleased functionality for the plugin :)
"everything is under control" - kasparov demo
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Hm, if you don't have that ORDER BY statement, it means you don't have
the latest version of the file *g*

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/
costa
Regular
Posts: 110
Joined: Wed Feb 08, 2006 5:29 pm
Location: Poland
Contact:

Post by costa »

seems i downloaded the plugin too soon. downloaded it again - everything is OK. thanks garvin!
"everything is under control" - kasparov demo
Guschtel
Posts: 2
Joined: Mon Sep 18, 2006 5:16 pm

Bug: Freetag Plugin on Postgresql "Related Entries by T

Post by Guschtel »

On (my) Postgresql the Query doesn't give any related Entries. This is due to the fact, that the order by columns have to appear in the select columns when using a Select distinct. This Patch fixes the issue (insert e2.timestamp in the selected columns):

---snip---
347,348c347
< e2.title,
< e2.timestamp
---
> e2.title
---snap---
Post Reply