Forums / Setup & design / Fetch only object with a checkbox-attribute enabled?

Fetch only object with a checkbox-attribute enabled?

Author Message

Frode Slettum

Saturday 27 May 2006 11:48:13 am

Hi

I have a class with a checkbox attribute. I want to fetch only nodes with this checkbox enabled. This would be my guess, but I'm not able to get it work:

fetch  ( content  , list  , hash  ( parent_node_id , $node.node_id , attribute_filter , array ( array ( 224 , = ,1 ) ) ) ) }

224 is the attribute (checkbox) id.

regards
Frode S.

Marcin Drozd

Saturday 27 May 2006 12:22:37 pm

Hi Frode

try with:

fetch( content, list, hash( parent_node_id, $node.node_id, attribute_filter, array( array( 224, '=', '1' ) ) ) ) }

spaces and single quotes are important

http://ez-publish.pl

Frode Slettum

Saturday 27 May 2006 2:50:17 pm

Hi!

Thanks a lot for a quick and good answer. The spaces in my template didn't look like this i posted here but after I did like you said it works :) Thanks a lot!

Didn't really know that spaces and quotes was that important...

Frode

Marc Boon

Monday 29 May 2006 5:23:42 am

Spaces are irrelevant, but the quotes around = are necessary, and they can be either single or double quotes, as long as they match.
You should technically quote all keys in a hash, since they are supposed to be strings. PHP and the eZ publish template language automatically convert identifiers that start with an alphabetical character to a string. This behaviour promotes sloppy coding, but it's easy so nobody complains about it.
In the case of the = character, which is not alphabetic, this conversion is not done automaticallay, that's why you have to quote it.
The manual specifies all functions with quoted identifiers, by the way. Like fetch('content', 'list', etc.), this is how it should be done. Read the manual!

Kristof Coomans

Monday 29 May 2006 5:49:54 am

Spaces are irrelevant

Spaces are irrelevant when used between the parameters of a template operator, but they shouldn't be used between a template operator and it's opening parenthesis.

Not right:

fetch ( ... )

Right:

fetch( ... )

This rule is also valid for <i>hash</i> and <i>array</i> (they are template operators too), as you can see in post 1 and 2 of this topic.

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

eZ debug

Timing: Jan 18 2025 11:11:57
Script start
Timing: Jan 18 2025 11:11:57
Module start 'content'
Timing: Jan 18 2025 11:11:57
Module end 'content'
Timing: Jan 18 2025 11:11:58
Script end

Main resources:

Total runtime0.1923 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0075 589.0547180.8125
Module start 'content' 0.00760.0061 769.867298.0547
Module end 'content' 0.01370.1785 867.9219526.2500
Script end 0.1922  1,394.1719 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00371.9468200.0002
Check MTime0.00150.7770200.0001
Mysql Total
Database connection0.00090.492510.0009
Mysqli_queries0.138772.11031410.0010
Looping result0.00140.73261390.0000
Template Total0.178192.610.1781
Template load0.00080.405010.0008
Template processing0.177392.187310.1773
Override
Cache load0.00060.287610.0006
Sytem overhead
Fetch class attribute can translate value0.00100.544510.0010
XML
Image XML parsing0.00030.140810.0003
General
dbfile0.00713.7007200.0004
String conversion0.00000.004230.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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs