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
|
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', '?&SearchText=', $node.name|urlencode, '&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
|