Related nodes & keywords for multi claesses ?

Author Message

Marvix Marx

Wednesday 21 May 2008 2:53:05 pm

Hi ..

am using this code to list the related node ... but not listing other classes nodes ?

{let related=$node.object.data_map.keywords.content.related_objects}
	{section show=$related}
                         <ul>
	{section name=Related loop=$related}
		<li><p><a href={$:item.url_alias|ezurl}>{$:item.name}</a></p></li>
	{/section}
			</ul>
	{/section}
{/let}

any solution ... am using version 4

Thanks

Ɓukasz Serwatka

Wednesday 21 May 2008 11:14:56 pm

Hi,

As fare as I remember this is correct behaviour. keyword based relations are made between objects of the same content class. You can use dedicated to relations datatypes.

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Marvix Marx

Thursday 22 May 2008 4:05:00 am

Hi,

sorry, but do you mean with "You can use dedicated to relations datatypes" ?

to add the related obj one by one ?

can this be fixed ?

There is article class and article_multipage class, you cann`t ignore one of them in the related ..

Marvix Marx

Thursday 22 May 2008 2:52:37 pm

OK, I wrote this code and its work fine for me, maybe some need it or can give better code!

<div>
{let RelatedKeywordArray=$node.object.data_map.keywords.content.keywords i=0}
     {foreach $RelatedKeywordArray as $RelatedKeyword}
    
    {def $kwlist=fetch(content,keyword, hash('alphabet', $RelatedKeyword, classid, array( '16' , '17'), limit, 5  ))}    	    	
    {foreach $kwlist as $RelatedNode}
        	
            {if $RelatedNode.keyword}
                {if ne($RelatedNode.link_object.node_id, $node.node_id)}
                	
                    {set $i=inc( $i )}
                    {if eq($i,1)}<ul>{/if}
                        <li><p><a href={$RelatedNode.link_object.url_alias|ezurl} title="{$RelatedNode.keyword}">{$RelatedNode.link_object.name}</a></p></li>
                    {if $i|eq(count($RelatedNode))}</ul>{/if}
				{/if}

            {/if}
     {/foreach}
    
    {undef $kwlist}
	{/foreach}
  {/let}  
  </div>

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.