Questions

Answers

How can I include the contents of one page into another?

{include:pagename}

back to top


How can I get the current page title?

With Velocity, you can use:

$content.getTitle()

With the reporting plugin, you can use:

{report-info:title}

back to top


How can I get the current space key using Velocity?

$sitemeshPage.getProperty("page.spacekey")

back to top


How can I develop a theme?

Themebuilder claims to make it easier to create a nice theme (a priced add-on product):

http://confluence.atlassian.com/display/CONFEXT/Theme+Builder

If you really want to do your own theme check out the tutorials linked to from here:

http://confluence.atlassian.com/display/DOC/Theme+Plugins

back to top


How can I find old, outdated pages?

With the reporting plugin, something like this:

{report-table}
{content-reporter:space=@self|type=page}
  {date-sort:content:modification date|order=descending}
  {date-filter:content:modification date|maxValue=-6M}
{content-reporter}

{report-column:title=Name}{report-info:content:title|link=true}{report-column}
{report-column:title=Modification Date}{report-info:content:modificiation date|format=dd MMM, yyyy}{report-column}

{report-empty}_No pages are currently more than 6 months old._{report-empty}

{report-table}

The 'maxValue=-6M' sets the minimum value to 'minus 6 months'. You can also set days, hours, minutes, years, etc.

back to top


How can I generate an email distribution list for all users?

With the reporting plugin, something like this:

{report-block:separator="; "}
{user-reporter}{user-reporter}
{report-body}{report-info:user:email}{report-body}
{report-block}

back to top


How can I get news from all spaces?

The report (reportng macro) markup below pulls in the 10 most recent news posts from all spaces, displaying the title, space, summary (first few words of the text), author and date:



{report-table:maxResults=10}

{content-reporter:spaces=@all|type=news}
{date-sort:content:modification date|order=descending}
{content-reporter}

{report-column:title=Title}{report-info:content:title|link=true}{report-column}
{report-column:title=Space}{report-info:content:space|link=true}{report-column}
{report-column:title=Summary}{report-info:content:summary}{report-column}
{report-column:title=Author}{report-info:content:creator}{report-column}
{report-column:title=Date}{report-info:content:creation date|format=dd MMM @ h:mm a}{report-column}

{report-empty}
_No news items are available._
{report-empty}

{report-table}

How can I stop certain theme elements from printing?

Simply give the element that you do not want to print a css class name called "noprint" or surround the element with a parent element having that CSS class. For example:

<div class="noprint">
...this is my Velocity code for page footer; I do not want the footer printed on a printer...
</div>

back to top


How can I render a macro from within a Velocity template?

Use of the attachments macro, for example:

$helper.renderConfluenceMacro("{attachments}")

If you do not already have access to the helper object from within your template, you'll need to get at that first like this:

#set($helper = $action.helper)

back to top


How can I print the number of comments on a page from a Velocity template?

See decorators/comments.vmd. To render only the comment count, use:

$action.getText("comments.count", [$page.comments.size()])

back to top


How can I get the Confluence version programatically?

There are ways to do it in Velocity, but if you need it within your Java plugin code, the following applies:

There are several helpful static methods in the class com.atlassian.confluence.util.GeneralUtil.

These include methods:
public static String getVersionNumber()
public static String getBuildNumber()

back to top


Where can I find where the Velocity macros are defined?

Commonly, you may want to review Atlassian's Velocity macros to see how they achieve certain results. That file can be found at:

<confluence-source>/confluence-project/conf-webapp/target/confluence/template/macros.vmd

There are currently no attachments on this page.

Labels:

Enter labels to add to this page:
Wait Image 
Tip: Looking for a label? Just start typing.