Hi Kevin,
I think I have done something quite similar to what you want to do :
#set ($hql = ", BaseObject as obj where obj.name=doc.fullName and
obj.className='XWiki.DomainClass'")
#foreach ($item in $xwiki.searchDocuments($hql))
#if($item==$doc)
#foreach ($domain in
$xwiki.getDocument($item).getObjects("XWiki.DomainClass"))
## put there your instructions, $domain contains all the DomainClass
objects which are on my page
#end
#end
#end
Kevin_C a écrit :
> I have a class in one of my spaces that has instances of itself attached. Eg.
>
> MySpace
> MySpace.TopicsClass
> MySpace.TopicsClass[0]
> MySpace.TopicsClass[1]
>
>
> How can I get the class from the space? I've tried:
>
> #set ($hql = ", BaseObject as obj where obj.name = doc.fullName and
> obj.className = 'FranchiseTax.TopicsClass' and doc.space='FranchiseTax'")
> #set($topics = $xwiki.searchDocuments($hql))
>
> Topics comes back with one item, which I can see by displaying
> $topics.get(0) and it prints out MySpace.TopicsClass. So it appears to have
> returned a string name of the document, however when I try:
>
> #set($topicObj = $xwiki.getDocument($topics.get(0)))
>
#set($topicObj = $xwiki.getObject($topics) should return you one object
#set($topicObj = $xwiki.getObjects($topics) should return you all objects
> Nothing is set into $topicObj. Do I have to do something different if the
> thing I am trying to get is a class and not a document? Once I have the
> class how do I get the collection of associated objects?
>
>
> Thanks!
> .:. Kevin
>
--
----
Jean Couteau
Code Lutin - http://www.codelutin.com
44 Bd des Pas Enchantés - 44230 St-Sébastien/Loire
Tél : 02 40 50 29 28 - Fax : 09 59 92 29 28
_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users