Hi,

On Thu, Sep 18, 2008 at 12:55 AM, mh <[EMAIL PROTECTED]> wrote:
> ---------- Forwarded message ----------
> From: mh <[EMAIL PROTECTED]>
> Date: Wed, Sep 17, 2008 at 11:44 AM
> Subject: Getting the domain name of a virtual wiki through velocity
> To: XWiki Developers <[EMAIL PROTECTED]>
>
>
> Hi,
>
> I have an XEM set up with with several virtual wikis on it. I'm trying
> to get the name of the virtual xwiki though velocity. For example, say
> that I have a XEM instance running two virtual wikis:
>
> 1) wikiA.domain.org
> 2) wikiB.domain.org
>
> on a XEM called xem.domain.org
>
> Im looking for the velocity code that will return the name (domain
> name) when embedded in a page of one of the virtual wikis. Something
> like: $xwiki.getServerName()
>
> if i put that in a page in wikiA, it should return "wikiA.domain.org".
> Likewise, if i put the same code in wikiB, it should return
> "wikiB.domain.org"
>
> I looked at  the velocity code for
> xem.doman.org/xwiki/bin/view/WikiManager/ because it lists the actual
> domain names under the "Domain Names" column. But it just gets a list
> of any virtual wikis available and lists them out. This page uses the
> xwikimanager plugin. I looked at the api and didn't see a way to
> directly get the domain name of the wiki in question. Could someone
> please point me in the right direction? Thanks in advanced and have a
> great day!

The domain name of a wiki is part of it's descriptor (like the owner
of the wiki etc.) and you can get the descriptor using
$wikimanager.getWikiFromName("wikiName"). Then this Wiki object
contains the list of aliasses of this wiki you can get using
getWikiAliasList() if you want them all or getFirstWikiAlias() if you
just want the one generally used when generating URLs like
[wikiname:Sapce.Page]. Here you can find all you see when you look at
XWiki/XWikiServerWikiname : owner, server, description... and some
helper like serverUrl, homePageUrl etc.

So to sumurize your use case in velocity (given that your wiki name is
"wikiname"):

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#set($wikiDesc = $wikimanager.getWikiFromName("wikiname"))
#set($wikiAlias = $wikiDesc.firstWikiAlias)

the server url of wiki "wikiname" is $wikiAlias.serverUrl and it's
home page is at $wikiAlias.homePageUrl
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

> -mh
> _______________________________________________
> users mailing list
> users@xwiki.org
> http://lists.xwiki.org/mailman/listinfo/users
>

Hope it helps

-- 
Thomas Mortagne
_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to