Forums / General / Fetching different classes with common attribute

Fetching different classes with common attribute

Author Message

Ted Striker

Monday 26 July 2004 8:00:20 am

Is it possible to filter two different classes that have a common attribute?

Lets say that we have different instances of an "article" class and some other of a "interview" class, with a common "date" (not publish date) attribute in the same foilder:

article/date
interview/date

Is it poossible to filter both classes and order them by this common attribute? Should I only use a single class in avery folder?

TIA

Can you feel it Mr. Anderson? Closing in on you? Oh I can, I really should thank you after all. It was, after all, it was your life that taught me the purpose of all life. Purpose of life is to end.

Roy Bøhmer

Tuesday 27 July 2004 1:23:40 am

The short answer is no!
Even if the identifiers are the same, ez sees them as two completely different attributes. (They've got their own attribute-id). When you define filter you either use the attribute-id or specifies which class you use (article/date). As far as I know it NOT possible to write

fetch(content, list, ...., 
    attribute_filter('or', 
                     array('article/date','<',current_date()),
                     array('interview/date','<',current_date())
                     ....)

My advice is to always do a class_filter when you're doing a attribute_filter.
A tip could be to do one fetch for articles and one for interviews, and afterwards combine the two arrays into one usin append. http://ez.no/ez_publish/documentation/reference/template_operators/arrays/append
The problem with this metod is that it is hard to do a proper sort across the classes.

By the way:
There is one advantage by giving your attribute the same identifiers: You can reuse template-code.

Roy

Bruce Morrison

Thursday 29 July 2004 4:20:02 pm

Hi Roy

> My advice is to always do a class_filter when you're doing a attribute_filter.

I'm pretty sure that I've found these to be mutually exclusive as one implies the other.
See: http://ez.no/community/forum/developer/using_attribute_filter_on_related_object_attributes

Have you had success?

Cheers
Bruce http://www.designit.com.au

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Andrew Vorobyov

Monday 13 June 2005 4:10:01 pm

I can't access in attribute_filter ezdate attribute by name

This works:

array(268,'>=',makedate(1,1,sub($today.year,$params.ageto)

This does NOT work:

array('class_name/ez_date_attr_name','>=',makedate(1,1,sub($today.year,$params.ageto)

eZ debug

Timing: Jan 18 2025 16:28:16
Script start
Timing: Jan 18 2025 16:28:16
Module start 'content'
Timing: Jan 18 2025 16:28:17
Module end 'content'
Timing: Jan 18 2025 16:28:17
Script end

Main resources:

Total runtime0.8824 sec
Peak memory usage4,096.0000 KB
Database Queries201

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0057 588.9531180.8203
Module start 'content' 0.00570.7649 769.7734631.8359
Module end 'content' 0.77060.1117 1,401.6094337.3750
Script end 0.8823  1,738.9844 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00390.4370210.0002
Check MTime0.00150.1723210.0001
Mysql Total
Database connection0.00070.080210.0007
Mysqli_queries0.817192.60002010.0041
Looping result0.00160.18671990.0000
Template Total0.855697.020.4278
Template load0.00230.258020.0011
Template processing0.853396.707520.4267
Template load and register function0.00010.013310.0001
states
state_id_array0.00080.091110.0008
state_identifier_array0.00090.107020.0005
Override
Cache load0.00190.2166350.0001
Sytem overhead
Fetch class attribute can translate value0.00100.114050.0002
Fetch class attribute name0.00100.110460.0002
XML
Image XML parsing0.00140.164250.0003
class_abstraction
Instantiating content class attribute0.00000.001060.0000
General
dbfile0.00250.2878330.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
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
10content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
6content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 27
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs