Skip to the content
Documentation

no keyword but result fetched

No ratings yet

Hi!
I use this to get all the articles in relation to a keyword. Here is the eZ code:

{def $related = fetch( 'content',  'keyword',  hash( 'alphabet', 'fashion',
                                    'sort_by',  array('published', false()) ) )}
{if ne($related, false)}
<ul>  Articles related to {$designer}
{foreach $related as $element}
    <li>{$element.link_object.name|wash}
    	{if ne($element.keyword, '')}
    		({$element.keyword|wash})
    	{/if}
   </li><br />
{/foreach}
</ul>

And this is my result

Articles related to fashion In store this week, 16 January 2008 (fashion)
# Global Traveller
# Global Traveller (fashion forward)
# In store this week, 9 January 2008 (Fashion)
# Home

I'm happy with it, but a bit surprised to see that if there is no keyword (ie when I get no "(fashion something)" an article can still be fetched. How comes?
It's not really a problem because I can change my code easily to have the title in the {if ne($element.keyword, '')} as well but I was really puzzled by the result.
Thanks if you can give me a clue

Comments (1 historical)

Written by readers of the earlier documentation sites, kept as they were.

  1. Re: no keyword but result fetched

    Emanuel ·

    Here is an error:
    {if ne($related, false)}
    right:
    {if ne($related, false())}
    greets