Forums / Developer / referencing of nodes in content structure tree

referencing of nodes in content structure tree

Author Message

Felix Gluecklich

Wednesday 16 January 2008 4:32:36 am

At first i try it to copy the folder node named "Advertising".
Then i like to say: "Advertising" is only one time in eZ Publish,
therefore this folder "Advertising" is not an copy or an move.

This folder has to be an reference or an link to the original
folder named "Advertising". One changing of "Advertising"
instance of class Advertising and overall the new content
will be visible. Could it be true with ez Publish?

But in the admin side i see no possibilities, to referencing
an node (folder, frontpage, etc.).

Literature
|- Advertising (folder)
|- Shakespeare (folder)
   | - Advertising* (folder) ( this folder as reference / link to Advertising - no copy! )
   | - Romeo und Julia (folder)
   | - what you want (folder)
   | - Hamlet (folder)
|- Goethe (folder)
   | - Advertising* (folder) ( this folder as reference / link Advertising - no copy! )
   | - Faust (folder)
   | - Erlkoenig (folder)
   | - Stella (folder)

Send me an tipp in detail. Thanks.

Piotrek Karaś

Wednesday 16 January 2008 12:40:19 pm

I'm not sure if I have understood your need completely, but my guess is that you could need locations mechanism, which happens to be one of the core content management features in eZ. See this article and other ones in that chapter:
http://ez.no/doc/ez_publish/technical_manual/4_0/concepts_and_basics/content_management/the_content_node_tree

Hope this helps,
Piotrek

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

Felix Gluecklich

Wednesday 16 January 2008 2:16:44 pm

I read your hint about locations. Look one more:

In software developing my example is like this:

Tree tree = new Tree();
Folder forum = new Folder("FORUM");
Folder news = new Folder("NEWS");
tree.add("1.0", news );
tree.add("2.3", news );
tree.add("4.0", forum);

The instance of folder is an reference / link.
The folder is on sereral locations in the tree.
I can change the content of folder, and
in every part of tree with an reference to my folder
the changed folder will show his content.

One place for changing updates all place with reference to this instance.

In the eZ doc about locations i am missing the place of node / object 31.
Where is the instance and where is the reference to this instance?

An reference to an instance point not to an object in memory,
it point to an place of address into an memory, like C++
An pointer to an pointer ... and so on.

I like to have one Node for writing about NEWS.
One time in my siteaccess and in my content structure.
The User in Role as Editor see only this place of real NEWS.

But my content structure is very big and large and have a lot of
sub trees and sub trees...

In several subtrees there are also an link or reference to NEWS.
This NEWS is pointing to my Node from above.

Just like the eZ location example... but i missing there the
real NEWS Node. Where this node have to be situated in content structure?

I think so:

Node 2
|- Node 10
   | - Node 12 NEWS <---- only here the editor will change content
   | - Node 13 Contact
| - Node 22
   |- reference to Node 12 News
   |- Node 223
|- Node 226
|- Node 401
   | - Node 422
   | - reference to Node 12 News

That what i want. What i am understand wrong?

Piotrek Karaś

Wednesday 16 January 2008 9:37:03 pm

Again, as far as I understand your examples, seems to me that we are talking about object locations. One object may have several node locations, one of which must be the main one. This main node location holds a physical object, the other ones only reference to the main one. Unfortunately, this native mechanism is object-level oriented and I don't think it will work for entire sub-structures. Folder follows the rules of any node/object, its subitems will not inherit from it, just like it happens with references in some operating systems. At least I'm not aware of such possibility.

Anyone else?

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

Tino Adams

Wednesday 16 January 2008 10:57:25 pm

Referencing content nodes including sub-tree is not possible.
Felix, your Tree/Folder example makes sense but can't be applied to ezPublishs content structure. The content structure (content tree) is build with content nodes where a node is a so called location and each node refering to one content object. So your code example in ezPublish would look something like:

$folderObject= new Folder();
$articleObject= new Article();

/*
Root
|_ Folder
| |_ Article
|_Folder <- same as first folder but no children
*/

$tree= new Tree();
$root= $tree->getRoot();

$folderNode= $root->addChild(new ContentNode($folderObject));
$articleNode= $folderNode->addChild(new ContentNode($articleObject));

$folderNode2= $root->addChild(new ContentNode($folderObject));

As you can see I was able to reference the Folder twice in the tree but none of it's children (Article). That's because content objects (Folder, Article) don't have hierarchical relations but content nodes do.

Hope that helps.

Peter Putzer

Thursday 17 January 2008 1:54:45 am

One solution is to create a "Reference" class that contains a single object relation attribute. Then you just have to create template overrides for all possible view modes for this class and show the corresponding view of the related node instead.

However, this does not work if you iterate over a multilevel hierarchy manualle (i.e. without using node_view_gui).

Accessible website starting from eZ publish 3.0 (currently: 4.1.0): http://pluspunkt.at

Felix Gluecklich

Thursday 17 January 2008 2:49:47 am

Yes, you are right: The solution is: using "location".

main node
|- Common
   |- news (location: berlin, dresden)
- berlin
  |- news * 
-dresden
  |- news *

* will appear here automatically as node "news",
if the new location is choosed for node "news".

In the popup-menu over the left content structure menu there are only
items for create, move and copy of content structure nodes.
The referencing / linking item (called location)
is only in the overview of the current node possible.

But it works...