Column Macro

This is a Velocity macro, which isn't bundled with any XWiki product by default.
Macro contributed by Thomas Eveilleau.
This macro can be downloaded.

Column Macro

Allow you to easily create columns in the content of a page

This macro is for syntax 1.0. For syntax 2.0, this macro should be preferred

Usage

#column(number of columns, justify, border)

Parameters definition

NameOptionalAllowed valuesDefault valueDescription
Number of columnsno2,3,4noneNumber of columns you want to display
Justifyyestruenone"true" to justify the text
Borderyestruenone"true" to add borders (black, 1px, solid)

Example

#column("2" "true" "false")
content of my first column
#endcolumn()
#column("2" "true" "false")
content of my second column
#endcolumn()

Result

2columns.png

Installation

This a Velocity macro. Since it's not bundled by default you'll have to copy/paste the following code to use it:

#macro(column $columns $justify $border)
#if($columns==2)
#set($width="48%")
#elseif($columns==3)
#set($width="32%")
#elseif($columns==4)
#set($width="23%")
#else
#set($width="23%")
#end
<div style="float:left;width:${width};padding:5px;#if($justify=="true")text-align:justify;#end #if($border=="true")border:1px solid black;#end">
#end

#macro(endcolumn) </div> #end

Tags:
Created by Thomas Eveilleau on 2008/05/05 18:34
Last modified by Jerome Velociter on 2009/12/16 16:03

This wiki is licensed under a Creative Commons license
2.2.1.27354