Monday 19 January 2009 12:50:55 pm
templates/content/datatype/view/ezkeyword.tpl from a recent project:
<p>{"Keywords used in this article:"|i18n("design/mydesign/keywords")}</p>
{def $keyword_array = $attribute.content.keyword_string|explode(',')
$keyword_count = 0
$keyword_string = ''}
{foreach $keyword_array as $keyword}
{set $keyword_string = $keyword|trim()}
{set $keyword_count = fetch( 'content', 'keyword_count', hash( 'alphabet', $keyword_string ) )}
{if $keyword_count|gt( 1 )}
<a href={concat('content/keyword/', $keyword_string)|ezurl}>{$keyword_string|wash}</a>
{else}
<span>{$keyword_string|wash}</span>
{/if}
{/foreach}
{undef}
With this you can easily set limit using max parameter on foreach, and you can also add classid in url as parameter if you want to filter on that. http://ez.no/doc/ez_publish/technical_manual/4_0/reference/modules/content/fetch_functions/keyword_count
But look like you want to link directly to the articles that use same keyword, so you should probably look at: http://ez.no/doc/ez_publish/technical_manual/4_0/reference/modules/content/fetch_functions/keyword
eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom
|