Forums / Setup & design / Can the keywords attribute be used to relate objects of different classes?

Can the keywords attribute be used to relate objects of different classes?

Author Message

Barney Gumble

Tuesday 27 January 2004 10:42:48 am

In 3.3.2 I'm using the standard method to find related objects, i.e.

{let related=$node.object.data_map.keywords.content.related_objects}
{section show=$related}
{section loop=$related}

This is working fine, however only objects of the same class are showing up. Is there any way that the above can be refined to show objects of a different class? This is required as I need to relate an event object to an article object for example.

Any help offered will be greatly appreciated as always!

Barney Gumble

Tuesday 27 January 2004 10:53:42 am

Looks like I might have just answered my own question, using the related objects from within the admin tool and this...

{section loop=$node.object.related_contentobject_array}

Still, any further pointers welcome.

Paul Borgermans

Tuesday 27 January 2004 11:22:04 am

Not with the current keyword datatype. There are new fetch functions for keywords (3.3-2) which you could use and where you can omit a class to fetch all objects of all classes sharing a specific keyword (or even the first x letters).

It's used in the pdf template functions and I used it to build a keyword index where each keyword is listed with all objects. It is obviously more powerful than $node.object.data_map.keywords.content.related_objects

syntax like

{let kwlist=fetch(content,keyword, hash('alphabet',<part or whole keyword>,  {*required*}
                            'classid',<class id>, {*optional, integer*}
                             'offset',<offset>, {*optional, integer*}
                             'limit',<limit> {*optional, integer*}
                           )}  

It returns a weird array with if you loop over it: $kwlist:item.keyword is available only once (facilitating output formatting) and $kwlist:item.link_object has the structure for displaying/linking

Do an {$kwlist:item|attribute(show,2)} and see for yourself. A more extended example will be in "the book".

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Barney Gumble

Tuesday 27 January 2004 11:45:25 am

Thanks Paul that's great. What's the latest news on the book? I need some new bedtime reading...

Bengt Skogly

Tuesday 27 January 2004 12:01:19 pm

What is "the book"?