Forums / Setup & design / Get all content of selection and text field attributes

Get all content of selection and text field attributes

Author Message

Karsten Jennissen

Monday 29 January 2007 4:23:30 am

Hi all,

I want to create a search function that works as follows:

* look into a node tree
* collect all avaible selection texts from a specific selection attribute
* display them
* texts are clickable and click shows all full objects that have that specific text in the selection attibute

E.g.
Contact address class, country is a selection attribute,
I want to search the node tree of available contacts and show only those countries in a list that are in the contact database.

How can I set up a fetch statement for this?

I also want to do this for textline attributes. E.g. the city in the address card is a textline. I want to be able to show all cities in the database.

Any tips on how to do this with a fetch function?

Thanks,
Karsten

Karsten Jennissen

Monday 29 January 2007 11:59:42 pm

I found a solution, for those that are interested.

Part 1: Display all the values of the attribute "sitz", if a value occurs more than once, show it only once. Count using attribute_filter. Generate a link per value with a view parameter "sitz" and the value as the parameter

{* Die Sitze durchlaufen. Wenn der Firmensitz noch nicht im Array enthalten ist, append. *}
{def $aktuellersitz=''}
{foreach $gruender as $aktuellergruender}
	{set $aktuellersitz=$aktuellergruender.object.data_map.sitz.content}
	{if $sitze|contains($aktuellersitz)|not()}
		{set $sitze=$sitze|append($aktuellersitz)}
	{/if}
{/foreach}

{* Ergebnisliste der Sitze durchlaufen, Anzahl anzeigen und Link zu Anzeigemaske generieren *}
{foreach $sitze as $sitzanzeige}
	{def $sitzanzahl=fetch( content, list_count, hash( parent_node_id, 69, attribute_filter, array( array( 'gruender/sitz', '=', $sitzanzeige) ) ) ) }
	{def $mainurlalias=concat($node.url_alias, "/(sitz)/", $sitzanzeige)}
	<a href={$mainurlalias|ezurl()}>{$sitzanzeige}</a> ({$sitzanzahl})<br />
{/foreach}

Part 2: Display using the view_parameter and attribute_filter:

{if $view_parameters.sitz}
	<h2>Firmensitz in {$view_parameters.sitz}</h2>
	{def $filterergebnis=fetch( content, list, hash( parent_node_id, 69, attribute_filter, array( array( 'gruender/sitz', '=', $view_parameters.sitz) ) ) ) }
	{foreach $filterergebnis as $gruender}
	        {node_view_gui view=line content_node=$gruender}
	{/foreach}
{else}
...

eZ debug

Timing: Jan 18 2025 04:30:44
Script start
Timing: Jan 18 2025 04:30:44
Module start 'content'
Timing: Jan 18 2025 04:30:45
Module end 'content'
Timing: Jan 18 2025 04:30:45
Script end

Main resources:

Total runtime1.2826 sec
Peak memory usage4,096.0000 KB
Database Queries189

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0084 589.0703180.8125
Module start 'content' 0.00841.0342 769.8828436.9922
Module end 'content' 1.04260.2399 1,206.8750333.7656
Script end 1.2825  1,540.6406 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00450.3494210.0002
Check MTime0.00180.1422210.0001
Mysql Total
Database connection0.00090.068110.0009
Mysqli_queries1.192092.93201890.0063
Looping result0.00250.19101870.0000
Template Total1.242996.920.6214
Template load0.00200.157120.0010
Template processing1.240896.743220.6204
Template load and register function0.00030.024510.0003
states
state_id_array0.00110.086610.0011
state_identifier_array0.00080.062720.0004
Override
Cache load0.00160.1263230.0001
Sytem overhead
Fetch class attribute can translate value0.00230.179720.0012
Fetch class attribute name0.00120.093320.0006
XML
Image XML parsing0.00040.033820.0002
class_abstraction
Instantiating content class attribute0.00000.000520.0000
General
dbfile0.00250.1920210.0001
String conversion0.00000.000730.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/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/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: 15
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs