Page tree
Skip to end of metadata
Go to start of metadata

To further customize the output of the macro, you can use a custom template. Templates are built using the powerful templating engine Velocity. Go to the PocketQuery administration, choose the tab "Templates" and click "Add Template".

We will use it to print the name of a country followed by its population, so name the template something like "population". For the content use the following code:

	#foreach($row in $result)
		<li><strong>${row.Name}: </strong>${row.Population}</li>

This snippet simply walks through the result row by row and each time prints a new <li> with the content of the columns "Name" and "Population" of the respective row.

Save the template. Then, go to your query and select the new template from the dropdown instead of "default":

Save the query, revisite the Confluence page with the PocketQuery macro and reload it. It will look completely different!

  • No labels