How to assess what page is currently being viewed by the user

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to assess what page is currently being viewed by the user

BrianJones
Hello community,

This may be a bit of an easy/stupid question, but bear with me!  Is there a way to assess what page is currently being viewed by the user (with Velocity), so that I may be able to do something like this:

#if (currentPage = someOtherPage)
   ...do this...
#else
   ... do something else...
#end

Any input on this would be amazing!  Cheers once again to the XWiki community.
Reply | Threaded
Open this post in threaded view
|

Re: How to assess what page is currently being viewed by the user

Sergiu Dumitriu-2
BrianJones wrote:

> Hello community,
>
> This may be a bit of an easy/stupid question, but bear with me!  Is there a
> way to assess what page is currently being viewed by the user (with
> Velocity), so that I may be able to do something like this:
>
> #if (currentPage = someOtherPage)
>    ...do this...
> #else
>    ... do something else...
> #end
>
> Any input on this would be amazing!  Cheers once again to the XWiki
> community.

$doc is the current document, an instance of com.xpn.xwiki.api.Document,
see
http://maven.xwiki.org/site/xwiki-core-parent/xwiki-core/apidocs/com/xpn/xwiki/api/Document.html

So, to get the name, just use:

#if($doc.fullName == 'Some.Document')

--
Sergiu Dumitriu
http://purl.org/net/sergiu/
_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: How to assess what page is currently being viewed by the user

BrianJones
Thanks Sergiu!


Sergiu Dumitriu-2 wrote
$doc is the current document, an instance of com.xpn.xwiki.api.Document,
see
http://maven.xwiki.org/site/xwiki-core-parent/xwiki-core/apidocs/com/xpn/xwiki/api/Document.html

So, to get the name, just use:

#if($doc.fullName == 'Some.Document')