Forums / Setup & design / passing variables from a class to fetch

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.

eZ debug

Timing: Jan 18 2025 11:24:01
Script start
Timing: Jan 18 2025 11:24:01
Module start 'content'
Timing: Jan 18 2025 11:24:02
Module end 'content'
Timing: Jan 18 2025 11:24:02
Script end

Main resources:

Total runtime1.0601 sec
Peak memory usage4,096.0000 KB
Database Queries205

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0067 588.9609180.8281
Module start 'content' 0.00670.9211 769.7891617.1484
Module end 'content' 0.92780.1323 1,386.9375337.0703
Script end 1.0601  1,724.0078 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00430.4035210.0002
Check MTime0.00160.1509210.0001
Mysql Total
Database connection0.00150.140910.0015
Mysqli_queries0.984092.81462050.0048
Looping result0.00190.17532030.0000
Template Total1.024396.620.5121
Template load0.00230.216720.0011
Template processing1.022096.401020.5110
Template load and register function0.00020.021010.0002
states
state_id_array0.00150.143410.0015
state_identifier_array0.00190.174720.0009
Override
Cache load0.00200.1840340.0001
Sytem overhead
Fetch class attribute can translate value0.00140.135640.0004
Fetch class attribute name0.00120.109480.0001
XML
Image XML parsing0.00120.115940.0003
class_abstraction
Instantiating content class attribute0.00000.001380.0000
General
dbfile0.00310.2917340.0001
String conversion0.00000.000530.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
9content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 23
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs