Forums / Setup & design / fetching attributes with the same name of two different classes

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

fetching attributes with the same name of two different classes

Author Message

Nicolas Heiringhoff

Friday 16 April 2004 1:58:38 am

hello everyone,

we have two different classes which have one attribute in common. This attribute is called "faq". Then we have a folder "documentation" with sveral subfolders like"subfolder1", "subfolder2", etc. Objects of the two classes are in the subfolders . It looks something like this:

Our example:

Node 196 (folder Documentation)
Subfolder 1 (Node ID 227) with class 1 (Class ID 28) with attribute "faq" (attribute id 247)
Subfolder 2 (Node ID 228) with class 2 (Class ID 29) with attribute "faq" (attribute id 246)

In Subfolder 3 off this node we would like to display the content of the two attributes "faq" of Class ID 28 and 29

does anyone have a suggestion?
thanx from germany

http://www.heiringhoff.de

Nicolas Heiringhoff

Friday 16 April 2004 3:54:07 am

Now we have found a solution by modyfing a code we have used before. With this code we can get the specific attribute.

{* Get the dokus (ClassID: "2"! Might be different for you!) *}
{let articles=fetch('content','list',hash(parent_node_id,204,$node.node_id,class_filter_type,"include",class_filter_array,array(29)))}

{* Get a count of the articles (ClassID: "2"! Might be different for you!) in this folder. *}
{let articles_count=fetch('content','list_count',hash(parent_node_id,$node.node_id,class_filter_type,"include",class_filter_array,array(28)))}

{* Now decide what to do *}
{switch name=decision match=$articles_count}
{case match=1}
{* Show this if there is only one article! E.g. include the "full article view" page. *}
{section name=Article loop=$articles}
{node_view_gui view=full content_node=$decision:Article:item}
{/section}
{/case}
{case}
{* Show this for more than one article. *}
{section name=Article loop=$articles}

{section name=read_link show=$decision:Article:item.contentobject_version_object.data_map.body}
<a href={concat("/content/view/full/",$decision:Article:item.node_id)|ezurl}>{$decision:Article:item.data_map.faq.data_text}</a>
{/section}

<br />

<img src={"trennlinie.png"|ezimage}
<br />


{/section}
{/case}
{/switch}

http://www.heiringhoff.de