This server will be upgraded at 3pm Sydney time on December 3rd (December 2nd, 8pm PST) and will be down for up to 30 minutes.
This documentation relates to the latest version of Confluence.
If you are using an earlier version, please go to the documentation home page and select the relevant version.

Confluence Objects Accessible From Velocity

All Versions
Click for all versions
Confluence 2.10 Documentation

Index

The complete list of objects available for use are:

Name Description Doc Reference
$body The body of the macro (if the macro has a body)  
$param0-n The parameters passed to your macro (as available)  
$param<name> Named parameters passed to your macro (as available)  
$config The BootstrapManager object, useful for retrieving Confluence properties BootstrapManager
$content The current ContentEntity object that this macro is a included in (if available) ContentEntityObject
$space The Space object that this content object is located in (if relevant) Space
$generalUtil A GeneralUtil object, with useful utility methods for URL encoding etc GeneralUtil
$action A blank ConfluenceActionSupport object, useful for retrieving i18n text if needed ConfluenceActionSupport
$webwork A VelocityWebWorkUtil object, for its htmlEncode() method VelocityWebWorkUtil
$req The current HttpServletRequest object (if the page is rendered as a result of an HTTP request) HttpServletRequest
$res The corresponding HttpServletResponse object (not recommended to be played with) HttpServletResponse
$userAccessor For retrieving users, groups and checking membership UserAccessor

Labels

velocity-related velocity-related Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Jan 16, 2007

    Matt Ryall (Atlassian) says:

    Actually, this totally depends on what Velocity file you're talking about. There...

    Actually, this totally depends on what Velocity file you're talking about. There are at least four different Velocity contexts that exist in Confluence:

    • user macros (listed above)
    • normal action results (*.vm)
    • Sitemesh decorators in themes or custom layouts (*.vmd)
    • notifications.

    The best reference until someone has time to write about it is the code. Check out the ConfluenceVelocityContext class for the normal action context, and the ProfilingPageFilter for the decorator context, and PreRenderedMailNotificationQueueItem for the notification context.

    1. Jan 16, 2007

      Matt Ryall (Atlassian) says:

      Oops, it's actually VelocityRenderedQueueItem for the notification context. More...

      Oops, it's actually VelocityRenderedQueueItem for the notification context. More information available in the [Confluence rendering pipeline] document.

  2. Oct 23, 2007

    Giles Lewis says:

    Is there any way to get a PageManager object from within a user macro?

    Is there any way to get a PageManager object from within a user macro?

    1. Oct 29, 2007

      Mei Yan Chan says:

      Hi Giles, Unfortunately, I am not aware of the PageManager object available for...

      Hi Giles,

      Unfortunately, I am not aware of the PageManager object available for use within user macro. Perhaps, you want to raise a feature request at the issue tracker at http://jira.atlassian.com.

      Regards,
      Mei

  3. Nov 25, 2007

    Anonymous says:

    I'm trying to modify lastblogs.vm to add some conditional logic to control a Mor...

    I'm trying to modify lastblogs.vm to add some conditional logic to control a More... link.  (There is already something in there for this feature, but it doesn't seem to be working).

    I see the $req, $generalUtil and $action objects being used in the file.  But I don't seem to have $content, which is the one I was hoping was going to let me figure out what page I was on.

    If that object isn't available, how can I determine what other objects may be available to use?

    Thanks!
    M.

    1. Nov 28, 2007

      Ming Giet Chong says:

      Hi, I would suggest you to post this question to the forum and mailing list as ...

      Hi,

      I would suggest you to post this question to the forum and mailing list as there might be other user/developers who have already implemented it and should be able to share their ideas with you.

      Regards,
      MG

  4. Mar 07, 2008

    Jeff Schnitter says:

    All of the links to the Doc reference are resulting in 404 errors. Will someone...

    All of the links to the Doc reference are resulting in 404 errors. Will someone from Atlassian please take a look? Thanks!

    1. Mar 10, 2008

      Choy Li Tham says:

      Hi Jeff, Thanks for reporting this. The links to the API documentation in this ...

      Hi Jeff,

      Thanks for reporting this. The links to the API documentation in this page has been changed. The API documentation are available at the following link now:

      Sorry for the inconvenience.

      Regards,
      Choy Li

  5. Apr 02, 2008

    Anonymous says:

    Yeah, and try clicking on some of the properties in UserAccessor, for instance. ...

    Yeah, and try clicking on some of the properties in UserAccessor, for instance. Click on "User". Page broken.

    1. Apr 03, 2008

      Tony Cheah Tong Nyee says:

      Hi there, Thanks for reporting this. We are in the process of correcting the li...

      Hi there,

      Thanks for reporting this. We are in the process of correcting the links in our Confluence's documentation due to the change of the new API URL. However, the direct link to the UserAccessor should be:

      Apologies for the inconvenience caused.

      Cheers,
      Tony

  6. Apr 30, 2008

    Anonymous says:

    how to pass argument to $helper.renderConfluenceMacro('Unknown macro: {useapi} '...

    how to pass argument to $helper.renderConfluenceMacro('

    Unknown macro: {useapi}
    ' for calling a macro

    1. May 02, 2008

      Mei Yan Chan says:

      Hi, Would you be able to elaborate more on what you are achieving? For all quer...

      Hi,

      Would you be able to elaborate more on what you are achieving? For all queries relating to development, please post them at:

      Regards,
      Mei

Add Comment