[xwiki-users] Linking to documents in different spaces
I am using this query: #set($hql = ", BaseObject as obj where obj.name=doc.fullName and obj.className='Space1.MyClass' and obj.name<>'${doc.space}.${class}ClassTemplate' and doc.space='MySpace'") to return a list of documents from a different space and I am trying to now create a view link to the document. I have tried several combinations using getUrl() but nothing seems to work. Here's some of the code I've tried: <ol> #foreach($faq in $recentlyCreated) #set($doc = $xwiki.getDocument('FranchiseTax', $faq)) <li>[$doc.question>$doc.getUrl("view")]</li> #end </ol> What am I missing? Thanks in Advance! .:. Kevin -- View this message in context: http://n2.nabble.com/Linking-to-documents-in-different-spaces-tp2156815p2156... Sent from the XWiki- Users mailing list archive at Nabble.com.
Kevin_C wrote:
I am using this query:
#set($hql = ", BaseObject as obj where obj.name=doc.fullName and obj.className='Space1.MyClass' and obj.name<>'${doc.space}.${class}ClassTemplate' and doc.space='MySpace'")
to return a list of documents from a different space and I am trying to now create a view link to the document. I have tried several combinations using getUrl() but nothing seems to work. Here's some of the code I've tried:
<ol> #foreach($faq in $recentlyCreated) #set($doc = $xwiki.getDocument('FranchiseTax', $faq))
Think about using a different name for this variable as $doc is the name of the default context variable which holds the current document. Use, for example, $faqDoc. #set($faqDoc = $xwiki.getDocument('FranchiseTax', $faq))
<li>[$doc.question>$doc.getUrl("view")]</li>
<li>[$faqDoc.question > $faqDoc.fullName]</li> should do it at this point, as [] marks a wikilink and Space.Page (which is exactly what fullName is) is a reference to the desired document. Happy coding, Anca Luca
#end </ol>
What am I missing?
Thanks in Advance! .:. Kevin
participants (2)
-
Anca Paula Luca -
Kevin_C