Share » Forums » Setup & design » Using view_parameters for sort

Using view_parameters for sort

Using view_parameters for sort

Sunday 16 October 2005 8:26:54 am - 2 replies

Author Message

Marko Žmak

Sunday 16 October 2005 9:02:13 am

Hi Fraser!

What you are doing wrong here is that you misunderstood what true() and false() eZ operators do...

They actually return the true or false value of type boolean, they DON'T return the "true()" or "false()" strings.

In your <A> tag:

<a href="http://localhost/corporate/organizations/(sort_direction)/true()" title="Sort Ascending">

you actually put the string value "true()" as value for sort_direction parameter so when you fetching code:

{def $nodes=fetch( 'content', 'list', hash( 'parent_node_id', $node.node_id, 'sort_by', array( 'attribute', $view_parameters.sort_direction,'organization/organization_name' ) ) )}

comes to the $view_parameters.sort_direction it gets the string value "true()" and not the boolean value as returned from true() opetator.

A sollution to your problem could be:

1) Make the <A> tag like this:

<a href="http://localhost/corporate/organizations/(sort_direction)/{true()}" title="Sort Ascending">

So the return value from the true() function will be set as sort_direction value. I'm not sure if this will work, but I think it should.

2) If the first sollution fails you could make the <A> tag like this:

<a href="http://localhost/corporate/organizations/(sort_direction)/1" title="Sort Ascending">

(or 0 for the false() case)
and then manually adjust the value of some variable to true() or false() depending of the value of $view_parameters.sort_direction. But try the 1st sollution first.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Fraser Hore

Sunday 16 October 2005 9:12:42 am

Your first option worked! Thanks so much! I really appreciate the help!

Cheers,

Fraser

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

36 542 Users on board!

Forums menu