This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » Install & configuration » Templates, fetch and sorting
expandshrink

Templates, fetch and sorting

Templates, fetch and sorting

Tuesday 14 January 2003 8:10:00 am - 6 replies

Having a need to sort the contents of a fetch I did some digging and have found some information in regards to the "sort_by" parameter of the fetch(content,tree,hash(parameters)) template function (and probally fetch(content,list,hash(parameters)) as well)

sort_by takes (multiple groups - I haven't tried this but the code looks like it will) of 2 parameters

sort field - the field to sort by. Valid options are
'path'
'published'
'modified'
'section'
'depth'
'class_identifier'
'class_name'
'priority'

sort_order
true = ascending
false = desending

So

fetch(content,tree,hash(parent_node_id,29,sort_by,array(published,true))

Will return all nodes under node 29 ordered from the first published to the last published.

If you do not have 2 parameters the sort will default to "path ascending"

I have also patched the system (3 additional lines) to enable to sort by object name. (See http://developer.ez.no/bug/bugview/1773/ )

Hope this helps someone.
Cheers
Bruce

Tuesday 14 January 2003 5:18:36 pm

> I have also patched the system (3 additional lines) to
> enable to sort by object name. (See
> http://developer.ez.no/bug/bugview/1773/ )

The name sorting patch has been added to the source with some template additions for selecting it.

Sunday 19 January 2003 2:14:04 pm

> > I have also patched the system (3 additional lines) to
> > enable to sort by object name. (See
> > http://developer.ez.no/bug/bugview/1773/ )
>
> The name sorting patch has been added to the source with
> some template additions for selecting it.

Ok, but if I want sort or filter results by any attribute?

Thanks in advance
Adolfo Barragán

Monday 20 January 2003 12:22:40 pm

> > > I have also patched the system (3 additional lines) to
> > > enable to sort by object name. (See
> > > http://developer.ez.no/bug/bugview/1773/ )
> >
> > The name sorting patch has been added to the source with
> > some template additions for selecting it.
>
> Ok, but if I want sort or filter results by any attribute?

This is not implemented yet so you just have to wait blunk.gif Emoticon

Monday 20 January 2003 1:43:44 pm

> > > > I have also patched the system (3 additional lines)
> to
> > > > enable to sort by object name. (See
> > > > http://developer.ez.no/bug/bugview/1773/ )
> > >
> > > The name sorting patch has been added to the source
> with
> > > some template additions for selecting it.
> >
> > Ok, but if I want sort or filter results by any
> attribute?
>
> This is not implemented yet so you just have to wait blunk.gif Emoticon

Or can't you do ugly (TM) things in combination with the name patch? Like using the name field for sorting but filling it with the value of any attribute?

Put <attribute-identifier> in the field for the object class name should do the trick? It displays ugly, but may make sense if sorting on any attribute is required.

--------------------natsort anyone?----------------
However, the "order by" clause of Mysql (and others) is rather limited. Perhaps ezp should do a two-staged sorting with php natsort() as an option.

This would get the right sorting order, for example:

fig1.png
fig3.png
fig12.png

instead of

fig1.png
fig12.png
fig3.png

Paul

Wednesday 29 January 2003 12:42:35 pm

> However, the "order by" clause of Mysql (and others) is
> rather limited. Perhaps ezp should do a two-staged sorting
> with php natsort() as an option.
>
> This would get the right sorting order, for example:
>
> fig1.png
> fig3.png
> fig12.png
>
> instead of
>
> fig1.png
> fig12.png
> fig3.png

Sorting in php won't work properly with fetch limitations the sorting needs to be done before the limitation.

Secondly natsort is much slower than normal sorting.

A possible solution is to use special sorting tables for attribute and advanced sorting, that way it could be possible to have custom code for sorting specific fields.
We have not decided on anything yet.

Monday 03 February 2003 8:00:40 am

> > > > I have also patched the system (3 additional lines)
> to
> > > > enable to sort by object name. (See
> > > > http://developer.ez.no/bug/bugview/1773/ )
> > >
> > > The name sorting patch has been added to the source
> with
> > > some template additions for selecting it.
> >
> > Ok, but if I want sort or filter results by any
> attribute?
>
> This is not implemented yet so you just have to wait blunk.gif Emoticon

So is this feature going to be in RC2 or the full version?

Having looked at the code I can see how this could be done but do not want to waste time on somthing that is being worked on by the eZ team.

What is happening with the development of eZ3? Last year there seemed to be a regular release schedule (of beta versions) and now nothing since RC1 over a month ago!

I very keen to use this product for a number of projects but deadlines are looming and I am getting quite nervous. I've already invested quite a bit of time into this and would greatly appreciate some news on the release of the next RC or full version.

Thanks
Bruce

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from