Jani Tarvainen
|
Friday 08 May 2009 1:33:25 pm
I would like to sort articles using the publish_time -attribute and _not_ the publish time of the object. Documentation states that: "The syntax for doing attribute level sorting is almost the same as for normal sorting. The only difference is that the ID number or the identifier of the target attribute must be specified. If the identifier is used then both the identifier of the class and the attribute must be specified (separated by a slash, like this: "my_class/my_attribute"). Attribute sorting can only be used if the returned collection contains the same type of nodes." -- http://ez.no/doc/ez_publish/technical_manual/4_0/reference/modules/content/fetch_functions/list So I modified my fetch from
{def
$nodes=fetch( 'content', 'list', hash(
'parent_node_id', 123,
'sort_by', array("published", false()),
'depth',1,
'class_filter_type', 'include',
'class_filter_array', array( 'article' )
))
}
to
{def
$nodes=fetch( 'content', 'list', hash(
'parent_node_id', 123,
'sort_by', array("article/publish_date", false()),
'depth',1,
'class_filter_type', 'include',
'class_filter_array', array( 'article' )
))
}
but now I get no results, just an error: "Unknown sort field: article_tkl/publish_time" along with an SQL error "Query error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DESC' at line 50." This is because the query ends with ... ORDER BY DESC. Is this a bug or am I doing something wrong?
--
http://ezpublish.fi/
|
Ivo Lukac
|
Friday 08 May 2009 1:53:04 pm
Try it like this:
{def
$nodes=fetch( 'content', 'list', hash(
'parent_node_id', 123,
'sort_by', array("attribute", false(),"article/publish_date"),
'depth',1,
'class_filter_type', 'include',
'class_filter_array', array( 'article' )
))
}
http://www.linkedin.com/in/ivolukac
http://www.netgen.hr/eng/blog
http://twitter.com/ilukac
|