Jump to content


Photo

NewsListing - sorting of


  • Please log in to reply
4 replies to this topic

#1 hmueller

hmueller

    Etomite Forum Newbie

  • Member
  • 31 posts

Posted 08 October 2004 - 04:29 PM

Hello,

I am using the NewsListing snippet for an calendar (I don't use the Calendar snippet, because my users want a list where all events are displayed (print out...).

So, If I add the following items:

27.9.04 add new event "monthly meeting"at 11.10.04
28.9.04 add new event "preparation for monthly meeting" at 7.10.04
1.10.04 add new event "christmas" at 24.12.04

so the sortorder at the NewsListing-page is

24.12.04
7.10.04
11.10.04

but the right order should be

7.10.04 (the next event first)
11.10.04 (!)
23.12.04 (!)

Is there any possibilty to sort-order the event entries (maybe by using menu index or so)?

#2 Ralph

Ralph

    Loves Etomite Forums!

  • Admin
  • 6,539 posts

Posted 08 October 2004 - 05:48 PM

Hello,

I am using the NewsListing snippet for an calendar (I don't use the Calendar snippet, because my users want a list where all events are displayed (print out...).

So, If I add the following items:

27.9.04 add new event "monthly meeting"at 11.10.04
28.9.04 add new event "preparation for monthly meeting" at 7.10.04
1.10.04 add new event "christmas" at 24.12.04

so the sortorder at the NewsListing-page is

24.12.04
7.10.04
11.10.04

but the right order should be

7.10.04 (the next event first)
11.10.04 (!)
23.12.04 (!)

Is there any possibilty to sort-order the event entries (maybe by using menu index or so)?

Try changing:
$resource = $etomite->getAllChildren($resourceparent, 'createdon', 'DESC', $fields='id, pagetitle, description, content, createdon, createdby');
To:
$resource = $etomite->getAllChildren($resourceparent, 'createdon', 'ASC', $fields='id, pagetitle, description, content, createdon, createdby');

The only shortcoming of the NewListing Snippet is that you can't sort by date descending and time ascending due to the fact that timestamps contain both the date and time... To sort in this fashion would require a custom SQL query which extracts both the date and time out of the timestamp and then sorts the records...

#3 hmueller

hmueller

    Etomite Forum Newbie

  • Member
  • 31 posts

Posted 09 October 2004 - 10:20 AM

Hello,

this does not work, because it's not only the other way round (see 7.11.04).

But is it possible to sort the blog/news entries by title?

Then I could set a number as title for each news entry and use this for sorting.

#4 Ralph

Ralph

    Loves Etomite Forums!

  • Admin
  • 6,539 posts

Posted 09 October 2004 - 02:23 PM

Hello,

this does not work, because it's not only the other way round (see 7.11.04).

But is it possible to sort the blog/news entries by title?

Then I could set a number as title for each news entry and use this for sorting.


You can sort by any field within the site_content table, but only a few fields are retrieved by etomite->getActiveChildren and etomite->getAllChildren by default... Check out the documentation for these API calls Here... So, in answer to your question, yes, you can sort by pagetitle, or by menuindex... As for the sorting by dates, all sorting is done on the actual timestamp, so the displayed format has no impact on the sort... There are plenty of ways to do your sorting other than using a numbered document title... Good Luck... If you have further questions, give a shout... B)

#5 hmueller

hmueller

    Etomite Forum Newbie

  • Member
  • 31 posts

Posted 09 October 2004 - 05:17 PM

Hello,

it's working. Thanks!
Only had to change the $sortField




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users