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}
...

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

eZ debug

Timing: Jan 18 2025 11:13:29
Script start
Timing: Jan 18 2025 11:13:29
Module start 'layout'
Timing: Jan 18 2025 11:13:29
Module start 'content'
Timing: Jan 18 2025 11:13:30
Module end 'content'
Timing: Jan 18 2025 11:13:30
Script end

Main resources:

Total runtime0.8437 sec
Peak memory usage4,096.0000 KB
Database Queries52

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0059 590.6641152.6563
Module start 'layout' 0.00590.0031 743.320339.5078
Module start 'content' 0.00910.8331 782.8281431.8828
Module end 'content' 0.84210.0015 1,214.71098.1094
Script end 0.8436  1,222.8203 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.3881160.0002
Check MTime0.00130.1592160.0001
Mysql Total
Database connection0.00080.093710.0008
Mysqli_queries0.794094.1106520.0153
Looping result0.00060.0664500.0000
Template Total0.803195.220.4016
Template load0.00200.240920.0010
Template processing0.801194.948620.4005
Template load and register function0.00030.036410.0003
states
state_id_array0.00130.152110.0013
state_identifier_array0.00170.205520.0009
Override
Cache load0.00170.1982230.0001
Sytem overhead
Fetch class attribute can translate value0.00050.059910.0005
Fetch class attribute name0.00280.331720.0014
XML
Image XML parsing0.00010.012010.0001
class_abstraction
Instantiating content class attribute0.00000.002620.0000
General
dbfile0.00060.0753100.0001
String conversion0.00000.001040.0000
Note: percentages do not add up to 100% because some accumulators overlap

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
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_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