Hi Kevin,

Kevin_C wrote:
> I have the following code in one of my pages and it does what I am expecting
> however I'd like to try and generalize it some.
> 
> #set ($hql = ", BaseObject as obj where obj.name = doc.fullName and
> obj.className = 'CPA_FAQs.FAQClass' and doc.space='MySpace'")

> #set($recentDocs = $xwiki.searchDocuments($hql, 5, 0))

See http://tinyurl.com/9pdh53

> #if($recentDocs.size() > 0)
>   <ol>
>   #foreach($entry in $recentDocs)

>     #set($faqDoc = $xwiki.getDocument('MySpace', $entry)) 

See http://tinyurl.com/8xlr2e

>     <li>[$faqDoc.question>$faqDoc.fullName]</li>

Here $faqDoc.fullName is the same with $entry

>   #end
>   </ol>
> #else
>   #info($noFAQs)
> #end
> 

> In this example is $entry an instance of com.xpn.xwiki.api.Object? If so, is

No, it's http://tinyurl.com/9hxpot

> there a way to get the space from it without doing
> $xwiki.getDocument('MySpace', $entry)? I would like to generalize that

Yes.

> statement so I can re-use the code for any documents in any space as opposed
> to having to hard-code the space.

## Add &space=MySpace to the query string of the URL
#set($lookupSpace = $request.space)

Hope this helps,
Marius

> 
> 
> Thanks!
> .:. Kevin
_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to