Hi Ryan
Yes, the CMS taglib is really useful and of course easier to use. Here
are the available tags: http://dev.magnolia.info/ref/3.5.4/magnolia-taglib-cms/tagreference.html
Maybe you read somewhere that we are talking about a "hierarchy of
nodes". So the Content Repository model shows a "node", with "child
nodes", etc., which looks like a "tree". Look at this "model" as a
hierarchically organized tree of addresses.
If you want to access the content behind the node (or address) you
have to FIRST instantiate a node object (or in Magnolia: a "Content"
object). This object gives you a nice set of methods to access the
content, but also to traverse the node hierarchy.
You noticed four ways of instantiating a node:
- Through the request (the URI represents a node)
- By instantiating a node object directly with the "path" (so the
complete hierarchy-address) or through direct access by means of the
UUID
- Through traversing or iterating through the hierarchy tree from a
given node
- By reading the result set of a search
But the security specification behind the JCR does not allow you to
just instantiate node objects as you wish. Each instantiation is
measured against the "user rights" (the Access Control List defining
"allows" and "denies" of nodes). While the request is automatically
checked (if you have no access you get an "Access Denied" error), an
instantiation of any other node happens through the "AccessManager" or
"HierarchyManager". So the reason you HAD to use the HierarchyManager
was to first check your access rights.
After walking through some basics, you should already have a feeling
how you want to develop your solution. There are two typical ways:
a) Tag Library
b) Java Code
You use a) already by defining the CMS:contentNodeIterator. Since the
contentNodeIterator has an attribute "contentNode", you can use the
contentNodeIterator again with the found node.
b) Is done by instantiating the "Content" object of the node you have
the UUID. From that object you use "getChildren()" to iterate through
the child pages of the node and get the properties. You can use
getChildren() to iterate through all the pages (ItemType.CONTENT) or
paragraphs (ItemType.CONTENTNODE).
HTH
Giancarlo
On Mar 10, 2008, at 7:32 PM, Ryan Bales wrote:
Hi Giancarlo -
Thanks for the tip -- I have been successful in getting that to
work. Perhaps you can suggest how might the best way to do the
following is:
I would like to iterator over a contentNodeCollection (using tag
lib, I assume is the best way to do this) -- each paragraph has a
node called "link" which has a UUID value (the UUID corresponds to
another page --not a child page) I would then like to iterate
through that linked page and display its content.
Your input would be great!
-Ryan
On Mar 10, 2008, at 3:00 PM, Giancarlo Berner wrote:
Hi Ryan
If you have the UUID of a node, then you have a direct access to
the node. To get that node (assuming it is not the node in the
request), you will need the "HierarchyManager". This way you can
verify the access rights (meaning that Magnolia checks if you have
the rights to access the page). Here is a sample:
Content thePage =
MgnlContext
.getHierarchyManager
(ContentRepository.WEBSITE).getContentByUUID(yourUUID);
From here on you can use a defined methods (e.g. getTitle() ) to
get the title-property of the page or go the conventional way
(thePage.getNodeData("myProperty").getString() ) to retrieve the
property value.
Check also on ContentUtil class, which provides convenience methods
to retrieve content.
HTH
Giancarlo
On Mar 10, 2008, at 12:52 PM, Ryan Bales wrote:
I am hoping that someone can kindly tell me the best way to return
a specific node value (a page's title for example) if that I have
page's UUID --xpath query? Any help would be great!
-Ryan
----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/docs/en/editor/stayupdated.html
----------------------------------------------------------------
----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/docs/en/editor/stayupdated.html
----------------------------------------------------------------
----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/docs/en/editor/stayupdated.html
----------------------------------------------------------------
----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/docs/en/editor/stayupdated.html
----------------------------------------------------------------