Forums / General / Fetch keyword problem

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

eZ debug

Timing: Jan 19 2025 01:24:32
Script start
Timing: Jan 19 2025 01:24:32
Module start 'content'
Timing: Jan 19 2025 01:24:32
Module end 'content'
Timing: Jan 19 2025 01:24:33
Script end

Main resources:

Total runtime0.1665 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.0062 590.2734180.8516
Module start 'content' 0.00620.0049 771.1250101.9297
Module end 'content' 0.01110.1553 873.0547530.7344
Script end 0.1664  1,403.7891 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00342.0140200.0002
Check MTime0.00150.8953200.0001
Mysql Total
Database connection0.00090.543710.0009
Mysqli_queries0.121172.74041410.0009
Looping result0.00140.86541390.0000
Template Total0.155093.110.1550
Template load0.00110.656010.0011
Template processing0.153992.428510.1539
Override
Cache load0.00060.344210.0006
Sytem overhead
Fetch class attribute can translate value0.00110.690810.0011
XML
Image XML parsing0.00030.160410.0003
General
dbfile0.00261.5810200.0001
String conversion0.00000.002930.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