Hi,

You can get the current space using $doc.space. You can also
use $blacklistedSpaces instead of a custom $hiddenSpaces list.
There a few syntax errors in your code, but they should be easy to fix.

Florin Ciubotaru


On Fri, Jan 13, 2012 at 9:46 AM, Hamster <[email protected]> wrote:

> This should be easy, but I am stuck :-(
>
> I have created a new panel. The panel shows all the document in the current
> space.
>
> But if the user is in the Main Space, I don't want to show any documents, I
> want to show all the spaces (except for a couple default spaces).
>
> #if $currentSpace = "Main"
>  #set ($hiddenSpaces = ["AnnotationCode", "ColorThemes", "Invitation",
> "Panels", "Scheduler", "Stats", "XWiki"])
>  #set($spacesSorted=$xwiki.sort($xwiki.spaces) )
>  #foreach($space in $spacesSorted)
>  #if (!$hiddenSpaces.contains($space))
>   * [[$space>>${space}.WebHome]]
>  #end
>  #end
> #else
>  // Code which shows all documents
> #end
>
> How do I know when I am in the Main Space?
>
> --
> View this message in context:
> http://xwiki.475771.n2.nabble.com/Get-current-space-velocity-tp7183403p7183403.html
> Sent from the XWiki- Dev mailing list archive at Nabble.com.
> _______________________________________________
> devs mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/devs
>
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to