passing variables from a class to fetch

Author Message

Matthew Almand

Monday 22 August 2005 4:55:49 am

OK I have searcheed the forums high and low and cannot nail down a solution to my dilemma, so I hope some of you developers can help me. Here goes.

In the layout of a site I am building I have content split over 2 columns left and right. module result is currently located in the left column but I want to 'continue' the result (after so many articles) into the right column. This in itself is easy by using offset in the fetch of the second column and setting a limit to what I want in the first column.

However, this amount and the other parameters (i.e sort_by, etc.) will be different for each page. Rather than creating an override for every page I want to set an integer or value by adding an extra element to the folder class and have that integer used when that folder class is displayed. NOw I am not a programmer so excuse my crude code below but I think it will give a good idea of what I am trying to do:

Folder has an Integer for 'limit', and 'offset' and a text line for class_filter_type and sort_by

{let $var_limit=$node.object.data_map.limit
     $var_offset=$node.object.data_map.offset}

{let children=fetch( content, list, hash( parent_node_id, $node.node_id,
                                     sort_by, $node.sort_array,
                                     offset, $var_offset,
					  limit, $var_limit, ) )}

{section name=Child loop=$children}
    {node_view_gui view=line content_node=$Child:item}
{/section}
{/let}
{/let}

so the attribute is read and defined as the variable in 'let' then the variable is called by the fetch. In the example above only the values for limit and offset.

What is wrong? I am missing some logic somewhere so any advice would be greatly appreciated.

Thanks
Matthew

Bård Farstad

Wednesday 24 August 2005 12:54:59 am

Hi Matthew,

did you check that the offset and limit values are correct. This can be done by adding a line after the let:

{$var_offset}

This should print the value. To get the integer value you need to ask the the $node.object.data_map.offset.content. So by changing the code as shown below should work:

{let $var_limit=$node.object.data_map.limit.content
     $var_offset=$node.object.data_map.offset.content}

Documentation: http://ez.no/doc

Matthew Almand

Wednesday 24 August 2005 1:01:43 am

cool!

Thanks Bård I will try this now!

:)

Matthew Almand

Wednesday 24 August 2005 1:35:16 am

That was the trick! Thanks Bård!

just a question to increase my eZ knowledge!

what is the output difference between having the .content and not having it on the end?

Kristof Coomans

Wednesday 24 August 2005 6:18:25 am

Without the .content, you'll get the object attribute itself (an instance of eZContentObjectAttribute).

With the .content, you'll get the object attribute's content. What this exactly is, depends on the used datatype.

For a text line for example, you'll get a variable with the text that was filled in. For an integer, you'll get a variable with the integer that was filled in. For a binary file, you'll get an instance of eZBinaryFile. Etc.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Matthew Almand

Thursday 25 August 2005 12:04:24 am

That clears it up thanks Kristof I understand it now.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.