Forums / General / fetch problem, doesn`t work properly

fetch problem, doesn`t work properly

Author Message

Mieczyslaw Morzonek

Tuesday 06 July 2004 6:08:01 am

I`ve the url somthing like this

ez/index.php/cms/trainees?mode=false&id=181

I want to sort by attribute 181, so i i`ve write something like this

fetch( 'content', 'list', hash( 'parent_node_id' , 
$node.node_id, 
'sort_by' ,
array('attribute' , concat(ezhttp( 'mode', 'get' ),"()")
, ezhttp( 'id', 'get' )),
'class_filter_type' ,  'include',
'class_filter_array', array( 'trainee' ) ) )}

I can not sort by ASC or DESC. The problem is in (ezhttp( 'mode', 'get' ),"()"). I don`t know how to construct true() or false form my URL. This source code (ezhttp( 'mode', 'get' ),"()") is not VISIBLE for the FETCH function.

Thanks for any help

Mieczyslaw Morzonek

Tuesday 06 July 2004 11:43:28 pm

I really need help, please. I need to sort data for every column of my table ASC or DESC... There is no {if} operator in ez templates?

Paul Forsyth

Wednesday 07 July 2004 3:26:37 am

Sometimes its good to separate out different function calls, eg:

{let getMode=ezhttp('mode','get')
     getID=ezhttp('id', 'get')
     result=fetch( 'content', 'list', hash( 'parent_node_id' , $node.node_id,
                                            'sort_by' , array('attribute' , concat($getMode,"()", $getID)),
                                            'class_filter_type' , 'include',
                                            'class_filter_array', array( 'trainee' ) ) )}

paul

--
http://www.visionwt.com

Mieczyslaw Morzonek

Wednesday 07 July 2004 5:42:14 am

Paul thank you for your idea, but it doesn`t work. I ve change part of your code {concat($getMode,"()", $getID)} to {concat($getMode,"(), ", $getID)} now the last parametr "ID" in`t visible for fetch function. I ve sql error ...

Query error: Something is wrong in your syntax near 'AND
                                   a0.version = ezcontentobj' in linie 18
  WHERE
                           path_string like '/1/2/67/%' and  depth <= 3 and 
                          
                          
                                   a0.contentobject_id = ezcontentobject.id AND
                                   a0.contentclassattribute_id =  AND // line 18
                                   a0.version = ezcontentobject_name.content_version AND
                                   a0.language_code = ezcontentobject_name.real_translation AND 

 

Any other idea how to sort data in table via columns ASC or DESC clicking column name? Is it {if} operator in ez templates?

{if $var == something}

... syntax

{elseif $var == something}

... syntax

{/if}

i ve also traing like this but it`s still doesn`t work

getMode=concat(ezhttp('mode','get'),"()")

I don`t know why? How to submit this 2 variables "mode" and "id" to fetch function?

I lost hope to solve this problem :( Is this a somekind of bug?

Paul Forsyth

Wednesday 07 July 2004 1:30:13 pm

THere is an 'if' operator. Use section:

{section show=eq($test, 1)}
Do something

 {section show=eq($test, 2)}
Do something different
 {/section}

{section-else}
Do something else
{/section}

Are you looking to create a true/false value for your sort_by array? Putting in text wont work - the value needs to a proper true/false value.

Hope this helps

paul

--
http://www.visionwt.com

Mieczyslaw Morzonek

Thursday 08 July 2004 3:42:00 am

It`s working. Paul u are great :) I ve used {section} to build my fetch syntax. In Smarty {if} operator is much confortable in use that {section} in ez templates.

Thanks!

Paul Forsyth

Thursday 08 July 2004 3:56:35 am

Excellent. Yip, i feel using sections for ifs are clumsy. The benefit is that section can be used for lots of other things.

At the end of the day it is just another language syntax that we have to learn as programmers. I've learnt lots of languages in my time and quickly learnt not to worry about naming choices :)

paul

PS. Very weird error. Edits appear in two places..............:

--
http://www.visionwt.com

Paul Forsyth

Thursday 08 July 2004 4:02:33 am

Sorry for the double post. Hit a weird weird problem:

http://ez.no/community/bug_reports/forum_editing_problem

!!!

paul

--
http://www.visionwt.com