Page 1 of 1

freetag plugin - related entries by tags in reverse order

Posted: Mon Jun 19, 2006 10:30 pm
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?

Posted: Tue Jun 20, 2006 10:07 am
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 :-)

Posted: Tue Jun 20, 2006 11:52 am
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

Posted: Tue Jun 20, 2006 11:41 pm
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.

Posted: Wed Jun 21, 2006 11:15 am
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

Posted: Wed Jun 21, 2006 5:08 pm
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 :)

Posted: Wed Jun 21, 2006 8:52 pm
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

Posted: Wed Jun 21, 2006 10:30 pm
by costa
seems i downloaded the plugin too soon. downloaded it again - everything is OK. thanks garvin!

Bug: Freetag Plugin on Postgresql "Related Entries by T

Posted: Wed Feb 07, 2007 3:59 pm
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---