Problems, need help? Have a tip or advice? Post it here.
5 posts Page 1 of 1
I've been trying to list pages by the most recent comment date. I can see orderby has an option for comment count, but nothing for comment date. Comment date is also not an editable region, so I can't go that route. Are there any options for this?
I'm afraid no. Not without writing custom queries.
How would I do that? Just a regular PHP sql query inside the couch tag?
How would I do that? Just a regular PHP sql query inside the couch tag?

It is explained here in detail -
2. Executing custom SQL queries. (viewtopic.php?f=5&t=7377)
I've managed to connect OpenOffice Base to my couch site database to explore how this query should be made and came up with this:

Code: Select all
Select "couch_comments"."date", "couch_comments"."page_id", "couch_comments"."data", "couch_pages"."page_name" from "couch_comments", "couch_pages" where "couch_comments"."tpl_id" = 39 and "couch_comments"."page_id" = "couch_pages"."id" order by "couch_comments"."date" DESC


This orders the template page names (I assume the basis for the page link tag ouput) in the order that I need (by newest comment). What I'm unclear on, is how to type this up in couch terms. I looked at the example, where are the "p.id pid, t.name tname, etc..." coming from? Is this syntax unique to the query tag? I haven't found much documentation beyond the forum about it.
5 posts Page 1 of 1