Fetch keyword problem

Author Message

Stéphane Bullier

Thursday 16 March 2006 6:49:20 am

Hello,

I have a interogation about the keyword fetching.

I have a class "News" with a keyword attribute "artist". I completed this field with the name of artist that has also the title of another class "artist" eq to $node.name.

When I want display the related "News" of an artist, I write :

{def  $related_news=fetch( 'content', 'keyword',
                                                  hash( alphabet, $node.name ) ) }
<ul>
{foreach $related_news as $element}
	<li><a href={$element.link_object.url_alias|ezurl()}>{$element.link_object.name|wash}</a></li>
{/foreach}
</ul>

All the related news are displayed 2 times. I don't understand why ?

Any feedback would be appreciated.
thanks,

Stéphane

Stéphane Bullier

Monday 27 March 2006 11:46:31 am

He everybody,

There is no solution of my question ?

Please any suggestion is welcome.

Thank. Bobo

Stéphane

Betsy Gamrat

Monday 27 March 2006 4:35:58 pm

Bobo,

Have it print out the $node.node_id and the class_id for the returned content. You may have two nodes that match the keyword.

Stéphane Bullier

Wednesday 29 March 2006 12:29:37 am

Hi Betsy Gamrat,

Yes I have. It's the same node_id for the two $element.link_object.name.

Stéphane

Betsy Gamrat

Wednesday 29 March 2006 7:21:38 am

Bobo,

It sounds like a bug to me.

You may be able to use http://ez.no/doc/ez_publish/technical_manual/3_6/reference/template_operators/arrays/unique as a workaround.

Good luck

Stéphane Bullier

Thursday 30 March 2006 11:38:01 pm

Hello Betsy Gamrat,

Thank you for your advice.

Finally, I use another solution with fetch list :

{def $root_node=fetch( 'content', 'node', hash( 'node_id', 59 ) )
	     $actus=fetch( 'content', 'list',
				          hash( 'parent_node_id', 59,
				       		    'sort_by',		  $root_node.sort_array ) )
		 $nbr_actus=fetch( 'content', 'list_count',
				             hash( 'parent_node_id', 59 ) )
		 $counter=0
		 $limit=1 }
				
		{if $actus}
		<h3 class="actu-artiste">{"News' artist"|i18n("design/base")}</h3>
			{while ne($counter, $nbr_actus) sequence $actus as $actu}
				{if eq($actu.data_map.artiste_lie.content.keyword_string|contains( $node.name ), 1)}
					{* Condition permettant de limiter le nombre d'actu à 3 *}
					{if le($limit, 3)}
						<p class="date-related-news">{$actu.data_map.date.data_int|datetime( 'mydate' )}</p>
						<h4 class="title-related-news">{$actu.name|wash()}</h4>
						<div class="deblayage"></div>
						<div class="related-news-content">
							{attribute_view_gui attribute=$actu.object.data_map.photo}
							{attribute_view_gui attribute=$actu.object.data_map.intro_actu}	
							{if eq($actu.data_map.corps_actu.has_content, true)}
								<p><a href={$actu.url_alias|ezurl()}>{"Read more..."|i18n("design/base")}</a></p>
							{/if}
						</div>
						<div class="deblayage"></div>
					{else}
						<p class="other-related-content"><a href={concat('/content/search', '?&amp;SearchText=', $node.name|urlencode, '&amp;SectionID=6')}>{"Other news of this artist"|i18n("design/base")}</a></p>
						{break}
					{/if}
					{set $limit=inc( $limit )}
				{/if}
				{set $counter=inc( $counter )}
			{/while}
		{/if}
		{undef}

and this solution works well.

Stéphane

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 19 2025 04:43:21
Script start
Timing: Jan 19 2025 04:43:21
Module start 'layout'
Timing: Jan 19 2025 04:43:21
Module start 'content'
Timing: Jan 19 2025 04:43:21
Module end 'content'
Timing: Jan 19 2025 04:43:21
Script end

Main resources:

Total runtime0.6898 sec
Peak memory usage4,096.0000 KB
Database Queries66

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0061 589.0469152.6094
Module start 'layout' 0.00620.0028 741.656339.4141
Module start 'content' 0.00900.6793 781.0703580.7734
Module end 'content' 0.68830.0015 1,361.843816.1875
Script end 0.6897  1,378.0313 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.4564160.0002
Check MTime0.00140.1990160.0001
Mysql Total
Database connection0.00070.104710.0007
Mysqli_queries0.619189.7486660.0094
Looping result0.00060.0900640.0000
Template Total0.658895.520.3294
Template load0.00210.310720.0011
Template processing0.656695.197620.3283
Template load and register function0.00030.039710.0003
states
state_id_array0.00100.150910.0010
state_identifier_array0.00070.107820.0004
Override
Cache load0.00180.2665390.0000
Sytem overhead
Fetch class attribute can translate value0.00130.185120.0006
Fetch class attribute name0.00240.354780.0003
XML
Image XML parsing0.00200.284320.0010
class_abstraction
Instantiating content class attribute0.00000.0036120.0000
General
dbfile0.00150.2206220.0001
String conversion0.00000.001340.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
6content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.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
2content/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
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 26
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs