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.

eZ debug

Timing: Jan 18 2025 15:19:59
Script start
Timing: Jan 18 2025 15:19:59
Module start 'layout'
Timing: Jan 18 2025 15:19:59
Module start 'content'
Timing: Jan 18 2025 15:20:00
Module end 'content'
Timing: Jan 18 2025 15:20:00
Script end

Main resources:

Total runtime0.9609 sec
Peak memory usage4,096.0000 KB
Database Queries60

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0078 588.0469152.6406
Module start 'layout' 0.00780.0032 740.687539.4766
Module start 'content' 0.01100.9484 780.1641550.4609
Module end 'content' 0.95940.0015 1,330.625012.1250
Script end 0.9609  1,342.7500 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.3368160.0002
Check MTime0.00130.1362160.0001
Mysql Total
Database connection0.00130.132010.0013
Mysqli_queries0.904994.1717600.0151
Looping result0.00070.0756580.0000
Template Total0.922996.020.4615
Template load0.00220.224620.0011
Template processing0.920795.820020.4604
Template load and register function0.00030.034810.0003
states
state_id_array0.00080.086210.0008
state_identifier_array0.00130.135520.0007
Override
Cache load0.00180.1876210.0001
Sytem overhead
Fetch class attribute can translate value0.00160.169320.0008
Fetch class attribute name0.00150.158950.0003
XML
Image XML parsing0.00090.095520.0005
class_abstraction
Instantiating content class attribute0.00000.001150.0000
General
dbfile0.00190.1974180.0001
String conversion0.00000.001440.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 14
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs