I think fetch doen't support defined fields. Look at http://ezwiki.blanko.info/index.php/3XHT_FetchFunction . In your case, the best i found is modified field, could be an solution.
You could create a post publish workflow which would read the date from an attribute in the object and then set it as publish date. This would ofcourse require writing a custom workflow type in PHP.
what is the difference between: "class_identifier" and "class_name" ? If I'm doing a fetch based on either of these, what would be the results?
any tips on writing the work flow to do this? I haven't experimented with workflows at all yet, and am a bit unsure of how to start....
It seems like this would a really useful piece of code.... is there away to define one of the classes in article to relate to published? I guess ultimately having a fetch support specific fields would be pretty important.
I have no good solution, if you find one please post it :)
A poor solution could be to specify the Object name pattern for your article class as article_date, and then sort_by name in the fetch-statement?
...but you wold have to republish all your articles(?), and also the change could make it difficult to identify your articles in the admin-site (since they would be listed by article_date there as well)...
This goes a bit hackish way but this is what I did to get sorted by the datetime field:
Object name pattern of the class were changed to <date><title> and then sorting can be done based to 'name'. It works fine. (I've got datetime field with identified 'date')
Has anyone tried Teemu's solution? Has it worked for you? I tried this, and it didn't work for me. I'm in the same bind, and if I can't come up with anything better, I'm going to have to figure out how to join like 4 tables in the database and manually change the publish date, or go through and make sure to publish everything again in the correct order.
I love ez3 - but this is a huge issue for me at this point.. any ideas would be greatly appreciated (ez crew, especially ;) )
If you can find a way to live with it you could make it a convention that the news article name starts with your article date written in reverse order (yyyy-mm-dd, e.g. 2003-07-21 for 21 July 2003). It's a bit awkward, but it does then allow you to sort on name to get a date sort.
I'm currently doing this on my news pages until the improved fetch function comes out in 3.2, which I understand will allow sorting on your own fields.
- Chris
You must be logged in to post messages in this topic!