Macros available in the dotCMS system

back to top
AddThis Social Bookmarks This macro generates bookmark links to the most popular social bookmarking sites with the use of the AddThis javascript library (http://www.addthis.com)

Macro Syntax:

#addThis(accountID)

Arguments:

Usage:

The macro will generate the links to the chosen sites

Example 1:

#addThis('dotmarketingAddThis')


Example 2:

#set($addthis_logo ='http://www.mysite.com/global/images/logo.gif')
#set($addthis_logo_background='EFEFEF')
#set($addthis_logo_color='666666')
#set($addthis_brand='My Site')
#set($addthis_options='delicious, digg, google, newsvine')
#set($addthis_offset_top='10')
#set($addthis_offset_left='10')
#set($addthis_bookmark_name='My Link Page')
#addThis('dotmarketingAddThis')



back to top
Add Browser Bookmark This macro generates a bookmark link on Internet Explorer and/or Firefox browser favorites folder

Macro Syntax:

#addBrowserBookmark()

Arguments:

Usage:

The macro will generate the link to the chosen sites on the browser favorite folder

Example :

#addBrowserBookmark()



back to top
Build RSS This macro generates a RSS xml from a map list. Then name of the keys in the map have to be: 'title' (String - required), 'link' (Identifier - required), 'description' (String - required), 'guid' (Identifier -required), 'pubdate' (Date - optional) and 'author' (String - optional). This macro uses the permalink macro to generate the items link in the RSS.

Macro Syntax:

#buildRSS(channelTitle channelLink channelDescription list)
Arguments:

Usage:

The macro will display all the content obtained by the pullcontent macro in the RSS

Example: This show a simple way to call the macro with the required fields

#set($contentList = $!{contents.getEmptyList()})
#pullContent($query '0' 'modDate desc')
#foreach($content in $list)
#set($item = $!{contents.getEmptyMap()})
#set($_dummy = $item.put('guid', $!content.identifier))
#set($_dummy = $item.put('title', $content.title))
#set($_dummy = $item.put('description', $content.description))
#set($_dummy = $item.put('link', $!content.identifier))
#set($_dummy = $item.put('pubdate', $!content.contentLastModDate))
#set($_dummy = $!contentList.add($item))
#end

#buildRSS('Channel Title','http://hostname/test/test.dot','Channel description', $contentList)

Example2: This example shows how to include one o more of the optional parameters

#set($permalinkDetailPage='123')
#set($contentList = $!{contents.getEmptyList()})
#pullContent($query '0' 'modDate desc')
#foreach($content in $list)
#set($item = $!{contents.getEmptyMap()})
#set($_dummy = $item.put('guid', $!content.identifier))
#set($_dummy = $item.put('title', $content.titleField))
#set($_dummy = $item.put('description', $content.description))
#set($_dummy = $item.put('link', $!content.identifier))
#set($_dummy = $item.put('pubdate', $!content.contentLastModDate))
#set($_dummy = $!contentList.add($item))
#end

#buildRSS('Channel Title','http://hostname/test/test.dot','Channel description', $contentList)


back to top
Build RSS From Content This macro generates an RSS xml from a content lucene query.

Macro Syntax:

#buildRSSFromContent(channelTitle channelLink channelDescription query titleField descriptionField)
Arguments:

Usage:

The macro will display all the content obtained by the pullcontent macro in the RSS

Example: This show a simple way to call the macro with the required fields

#buildRSSFromContent('Channel Title','http://hostname/test/test.dot','Channel description','+type:content +deleted:false +structureInode:77290 +(+languageId:1* +live:true))','test1','test6')

Example2: This example shows how to include one o more of the optional parameters.

#set($permalinkDetailPage='123')
#buildRSSFromContent('Test Title','http://hostname/test/test.dot','Channel description','+type:content +deleted:false +structureInode:77290 +(+languageId:1* +live:true))','test1','test6')



back to top
comment: Add a Generic comment Component to a Page This macro will allow you to add a generic component to any contentlet in the system. If you set the commentsModeration you could create workflow task over this component.

Macro Syntax:

   comment($contentlet.inode)
Arguments: Optional Parameters:

Usage:
Use this macro if you want to add a form to comment a contentlet, the macro, will add a form to add new comments and list the comments order by publish date.

Example 1: #set($commentForceLogin = 'false')
#set($commentAutoPublish = 'true')
#set($commentUseCaptcha = 'true')
#set($commentUseAudioCaptcha = 'true')
#set($commentUseAudioCaptchaHeight = 200)
#set($commentStripHTML = 'false')
#set($commentTitle = 'This is the question to comment')
#comment($content.inode)

Example 2: This example generate a content comment and a workflow task from that comment

#set($commentForceLogin = 'false')
#set($commentAutoPublish = 'true')
#set($commentUseCaptcha = 'false')
#set($commentStripHTML = 'false')
#set($commentsModeration = 'Editor')
#set($commentForceLogin= 'true')
#comment($content.inode)


back to top
Return diferent messages depending the input date. The input date must be before the current date.

View Tool Syntax:

$dateviewapi.friendly(date)
Arguments:

Usage:

Use this to show the difference date and time between a string date (before the current date) and the current date.

Example 1:


Wed, 02 Apr 2008 16:23:14 +0000<br>
#set ($tempDate = $UtilMethods.parseDate("Wed, 02 Apr 2008 16:23:14 +0000", "EEE, dd MMM yyyy HH:mm:ss +SSSS"))
Result Message: $dateviewapi.friendly($tempDate)<br>
Assuming that current date is: Fri, 02 May 2008 17:20:00 - The output will be: Wed., April 2, 4:23 PM

Example 2:


Sat, 26 Apr 2008 16:23:14 +0000<br>
#set ($tempDate = $UtilMethods.parseDate("Sat, 26 Apr 2008 16:23:14 +0000", "EEE, dd MMM yyyy HH:mm:ss +SSSS"))
Result Message: $dateviewapi.friendly($tempDate)<br>
Assuming that current date is: Fri, 02 May 2008 17:20:00 - The output will be: Saturday at 4:23 PM

Example 3:


Thu, 01 May 2008 16:23:14 +0000<br>
#set ($tempDate = $UtilMethods.parseDate("Thu, 01 May 2008 16:23:14 +0000", "EEE, dd MMM yyyy HH:mm:ss +SSSS"))
Result Message: $dateviewapi.friendly($tempDate)<br>
Assuming that current date is: Fri, 02 May 2008 17:20:00 - The output will be: Yesterday at 4:23 PM

Example 4:


Fri, 02 May 2008 14:20:00 +0000<br>
#set ($tempDate = $UtilMethods.parseDate("Fri, 02 May 2008 14:20:00 +0000", "EEE, dd MMM yyyy HH:mm:ss +SSSS"))
Result Message: $dateviewapi.friendly($tempDate)<br>
Assuming that current date is: Fri, 02 Apr 2008 17:20:00 - The output will be: 3 hour(s) ago

Example 5:


Fri, 02 May 2008 17:10:00 +0000<br>
#set ($tempDate = $UtilMethods.parseDate("Fri, 02 May 2008 17:10:00 +0000", "EEE, dd MMM yyyy HH:mm:ss +SSSS"))
Result Message: $dateviewapi.friendly($tempDate)<br>
Assuming that current date is: Fri, 02 May 2008 17:20:00 - The output will be: 10 minute(s) ago

back to top
detailPageLink : Gets the details page link for a given contentlet. The link title can also be specified, otherwise the macro will attemtp to find a contentlet field with the name 'title' and use this as the default link title. If the 'Detail Page' structure field has not been set, the link will be composed of the current page url plus the parameter. Note that the name of the request parameter used for passing the selected inode to the details page, is determined by the properties key "INODE_PARAMETER_NAME". In case this key is missing, the parameter name defaults to "inode"

Macro Syntax:

detailPageLink($content)
Arguments: Optional Parameters:

Usage:
Use this macro to get the detail page for a piece of content

Example 1: #set($linkTitle = 'My Title') #detailPageLink($content)


back to top
Content Rating The getRating macro, it's used to display a five start scale, that's the user's evaluation on the article. Also the macro allows the user evaluate this contentlet.

Macro Syntax:

#getRating(content_identifier)
Arguments:

Usage:

This macro will automatically show a five start menu indicating the acceptances for the contentlet.

Example:

#getRating($content.identifier)

Optional Parameters:

back to top
Content Ticker

This macro takes a list of content items, and displays them each based on the titleField and titleDescription. It rotates each piece of content and fades them out of the page to show the next one. Optional parameters can determine the fade length and colors as well as the time between each ticker display.

Macro Syntax:

#ticker()
Arguments: Optional Parameters:

Usage:
Use this macro if you want to add a content ticker to your site. You need to call the pullContent macro before calling the ticker macro, to provide the ticker with the list of content to display.

Example:

#pullContent('+type:content +deleted:false +structureInode:5 +(+languageId:1* +live:true)' '10' '')
#set($titleField = 'NewsHeadline')
#ticker($titleField)

Example with Optional Parameters:

#pullContent('+type:content +deleted:false +structureInode:5 +(+languageId:1* +live:true)' '10' '')
#set($titleField = 'NewsHeadline')
#set($descriptionField = 'NewsSummary')
#set ($fadeInLenth = 500)
#set ($fadeOutLenth = 500)
#set ($displayLength = 2000)
#set ($fgcolor = "#1A50B8")
#set ($bgcolor = "#ffffff")
#set ($fgcolorDescription = "#AAAAAA")
#set ($bgcolorDescription = "#ffffff")
#set ($tickerSourceCode = "/my_velocity_files/my_ticker.vtl")
#ticker($titleField)

back to top
Crumbtrail Builder This macro will build a crumbtrail using the path to the current page using unordered lists. This list can then be formated by css. The resulting code will look like.
<ul>
	<li><a href="/">Home</a></li>
	<li><a href="/folder_name/">Folder Name</a></li>
	<li>Page Name</li>  <-- No Link for current page
</ul>

Macro Syntax:

#crumbTrail()
Arguments:
Optional Parameters:

Usage:
The crumbtrail builder will create an unordered list of links, starting from the site root or "Home Page". It will then use the folder names for folders, build the path to the current page, and then display the page title as the last link. The resulting html can be easily formatted by wrapping it in a <div> tag and assigning it appropiate css styles.

Example 1:

<div id="crumbtrail">
   #crumbTrail()
</div>
This would build the required crumbtrail to the current page.

Example 2:

#set($homePath = '/about/')
<div id="crumbtrail">
   #crumbTrail()
</div>
This would build the required crumbtrail to the current page, setting the path of the home folder point to index page on the "about" folder.

If your are in http://www.yoursite.com/athletics/news/news_list.dot and set the homePath point to about folder, you will get this result.
<ul>
	<li><a href="/about/">Home</a></li>
	<li><a href="/athletics/">Athletics</a></li>
	<li><a href="/athletics/news/">News</a></li>
	<li>News Listing</li>  <-- No Link for current page
</ul>

back to top
Display File, Page or Contentlet Trackback History This macro display a list of all the trackback pings made to the permalink showing the title,url, trackback date,blog name, and asset Identifier

Macro Syntax:

#pullTrackbacks(identifier)
Arguments:

Usage:

Example:

#pullTrackbacks('12345')
#if($list.size() >0)
#foreach($track in $list)
Asset Identifier:$!{track.assetIdentifier}
Title:$!{track.title}
Excerpt:$!{track.excerpt}
URL:$!{track.url}
Blog Name:$!{track.blogName}
Trackback Date:$!{track.trackDate}
#end
#else
  • No Trackbacks found

  • #end



    back to top
    Displaying Resized Images This macro will automatically create and display a resized image in your image html tag, with the height and width you specify in the servlet parameters. The servlet allows you to create new images with the size you prefer, specifying the width, height or both. If you want to display an image, but you don't know the exact values of the width and height to display the image proportionally, this servlet allows you specify the maximum height and maximun width the image could have, and generate a proportional image that doesn't exceed those values.

    Macro Syntax:

       <img src="/resize_image?[[path] or [identifier]]
       &[ [[height] and/or [width]] or [[maxh] and [maxw]] ]">
    
    Arguments:

    Usage:
    The use of this servlet is very easy. You only have to add in the src attribute of the html image tag, the following text < img src="/resize_image?<parameters> " >

    Example:

       <img src="/resize_image?path=/images/image.jpg&maxw=120&maxh=130">
       <img src="/resize_image?id=91&maxw=120&maxh=130">
       <img src="/resize_image?path=/images/image.jpg&w=80&h=80">
       <img src="/resize_image?id=91&w=80&h=80">
       <img src="/resize_image?path=/images/image.jpg&w=80">
       <img src="/resize_image?id=91&w=80">
       <img src="/resize_image?path=/images/image.jpg&h=80">
       <img src="/resize_image?id=91&h=80">
    
    back to top
    Displaying Thumbnail Images This macro will automatically create and display a thumbnail image in your image html tag, with the height and width you specify in the servlet parameters. The servlet allows you to create new images with the size you prefer, specifying the width, height or both.The thumbnail generates an image with a background color and places the resized image within the thumbnail. The background color can be changed with the parameters r,g,b.

    Macro Syntax:

       <img src="/thumbnail?id=[identifier]&[ [[height] and/or [width]] or [[r] and [g] and [b]] ]">
    
    Arguments:

    Usage:
    The use of this servlet is very easy. You only have to add in the src attribute of the html image tag, the following text < img src="/thumbnail?<parameters> " >

    Example:

       <img src="/thumbnail?id=91&w=120&h=130">
       <img src="/thumbnail?id=91&w=120">
       <img src="/thumbnail?id=91&h=130">
       <img src="/thumbnail?id=91&w=120&h=130&r=200&g=100&b=50">
    
    back to top
    Decrypt This macro allows to decrypt a string that was encrypted with #encrypt. The decrypted value is saved in the variable: $decryptedStr. If you want to echo out the decrypted value use: $crypt.decrypt('string to decrypt').

    Macro Syntax:

    #decrypt('string to decrypt')
    Arguments:

    Usage:

    Example:

    #encrypt('website@dotcms.org')
    #decrypt($encryptedStr)
    This is the decrypted value = $decryptedStr
    
    
    
    back to top
    Encrypt This macro allows to encrypt a string. The encryted emails can be used in email forms to avoid having email address in plain text. The encrypted value is saved in the variable: $encryptedStr. If you want to echo out the decrypted value use: $crypt.crypt('string to encrypt').

    Macro Syntax:

    #encrypt('string to encrypt')
    Arguments:

    Usage:

    Example:

    #encrypt('website@dotcms.org')
    #set ($to = $encryptedStr)
    
    
    
    
    back to top
    Events Listings

    Macro Syntax:

    #events('from' 'to')
    Arguments:

    Usage:

    Example:

    #events('1/1/2006' '2/1/2006')
    

    back to top
    Execute SQL Query This macro will allow you to execute a select statement on any predefined datasource.

    Macro Syntax:

       #getSQLResults('select * from table')
    
    Arguments:
  • dbMaxRow
    Optional: If you set dbMaxRow your results will be limited to your maxRows. When possible your should do this with a limit in your query./li>

    Usage:
    Use this macro if you want to pull data from a database and display the results within some piece of content. If the SQL throws an error it will store the error in a variable named SQLError. See the example below for instructions on how to use this. It is only optional that you check for the error but it is recommended that you do so that your sql won't fail silently.

    Example:

    #set ($dbConnection = 'jdbc/test1')
    #set ($dbStartRow = 1)
    #set ($dbMaxRow = 4)
    #getSQLResults('select * from test order by id')
    $SQLError
    #foreach($r in $results)
    $r.id
    
    #end

    Example 2 - Here you see the the error being checked for and a custom message being throw on error:

    #set ($dbConnection = 'jdbc/test1')
    #set ($dbStartRow = 1)
    #set ($dbMaxRow = 4)
    #getSQLResults('select * from test order by id')
    #if($SQLError)
    Custom SQL message - I Failed
    #else
    #foreach($r in $results)
    $r.id
    
    #end #end

  • back to top
    Add to Favorites This macro will display a button that will allow the user to add this page to their bookmarks / favorites. This only works for logged in users in the frontend. If the user is not logged in the macro will redirect the user to the login page.

    Macro Syntax:

       #addToFavorites()
    
    Optional:

    Example:

    #addToFavorites()
    
    This will add the Add to Favorites button with default labels.
    #set($addFavoritesLabel = 'Add to My Favorites')
    #set($removeFavoritesLabel = 'Remove from My Favorites')
    #addToFavorites()
    
    This will add the Add to Favorites button with specified labels.

    back to top
    Get Favorites This macro will return a list of the logged in user favorites. If the user is not logged in the list will be returned empty.

    Macro Syntax:

    #getFavorites()
    

    Example:

    #getFavorites()
    
    #end
    
    This will get the list of favorites and print them in an unordered list.

    back to top
    File Repository This macro will automatically create a file repository using the path sent to it as the "root" folder.

    Macro Syntax:

       #fileRepository('path')
    
    Arguments: Optional Parameters:

    Usage:
    The repository will show a list of files and folders that the view user has permissions to view. If the user is not logged in, they will only be able to view files and folders that have the CMS_ANONYMOUS read permission. If the user is logged in, they will be able to view any files and folders they have read permission on.

    Example:

       #fileRepository('/resources/documentation')
    
    This would build a file repository from the contents found in the CMS folder /resources/documentation. If there were any sub folders, the user would be able to click through and view these as well.
     #set($fileRepositorySourceCode = '/application/file_repository.vtl')
    #fileRepository('/documentation/repository')
    And the /application/file_repository.vtl file could look like this
    #foreach($file in $fileRepository_filesList)
    #set($imgpath = "/contentAsset/resize-image/${file.identifier}/fileAsset&w=178")
    
    <img src='$imgpath' alt=""/> #end
    Another example of code for /application/file_repository.vtl could be like this: <ul> #foreach($file in $fileRepository_filesList) <li> Filename: ${fileRepository_showFolder}${file.fileName}
    Extension: ${file.getExtension()}
    Friendly Name:$!{file.friendlyName}
    File Size:$!{file.size}
    Publish Date: $!{file.publishDate} </li> #end </ul>
    back to top
    Link Repository This macro will automatically create a link repository using the path sent to it as the "root" folder.

    Macro Syntax:

       #linkRepository('path')
    
    Arguments: Optional Parameters:

    Usage:
    The repository will show a list of links.

    Example:

       #linkRepository('/resources/documentation')
    
    This would build a link repository from the contents found in the CMS folder /resources/documentation.
    #set($linkRepositorySourceCode = '/application/file_repository.vtl')
    #linkRepository('/documentation/repository')
    And the /application/file_repository.vtl file could look like this
    <ul>
    #foreach($link in $linkList)
      #if($!{link.linkType} == 'CODE')
        #set($lc = $link.getLinkCode())
        #set($lc = $UtilMethods.espaceVariableForVelocity($lc))
        #set($lc = $UtilMethods.restoreVariableForVelocity($lc))
        <li>$UtilMethods.evaluateVelocity($lc,$velocityContext)</li>
      #else
        <li><a href="$!{link.protocal}$!{link.url}" target="$!{link.target}">$!{link.title}</a></li>
      #end
    #end
    </ul>
    

    back to top
    Loads a Piece of Content From its Identifier This macro will take an identifier of a piece of content and sets it to a variable $content

    Macro Syntax:

    		#getContent(contentIdentifier)
    	

    Example:

    		#set($id = $request.getParameter("id"))
    #if($id)
    #getContent($id)
    #end
    My title is $content.title

    back to top
    Let you retrieve result from a google mini appliance.

    View Tool Syntax:

    $googleapi.searchGoogleMini(client, collection, subcollection, query, metaquery, start, num, autoFilter)
    
    Arguments:

    Usage:

    Use this to pull search results from a google mini appliance, to make this web api work you have to setup the variable GOOGLE_MINI_SEARCH_URL on the dotmarketing.config.properties file pointing to the google mini appliance url like GOOGLE_MINI_SEARCH_URL=http://googlemini.dotcms.org

    The api returns an specific GoogleMiniSearch object that contains all the variables necessary to display all the retrieved results.

    GoogleMiniSearch Object - Attributes

    	searchTime - The time taken by the appliance to retrieve the results
    query - The request query
    fromIndex - The start index of results
    toIndex - The end index of retrieved results
    estimatedTotal - The estimated total of result based on the given query
    searchResults - The list of results, this is a list of GoogleMiniSearchResult objects
    hasNextPage() - Method that returns true if results has a next page to display
    hasPreviousPage() - Method that returns true if results has a previous page to display
    GoogleMiniSearchResult - Attributes
    	identationLevel - Level of indentation used for inner results
    mimeType - Mime type of the result
    resultURL - The url to the result
    title - The title
    generalRatingRelevance - Relevance of the document in google mini
    additionalSearchDetails - More details about the retrived document
    snippet - Result snippet
    metaTagsFields - A map of metatags associated to the result

    Example:

    
    #set($searchObj = $googleapi.searchGoogleMini("default_frontend", "Main_Site", "", "Knight", "", 0, 100, false))
    <b>Search Summary</b><br/>
    <b>Total Search time:</b> $searchObj.searchTime<br/>
    <b>Query:</b> $searchObj.query<br/>
    <b>From Index:</b> $searchObj.fromIndex<br/>
    <b>To Index:</b> $searchObj.toIndex<br/>
    <b>Estimated Total:</b> $searchObj.estimatedTotal<br/>
    <b>Has Next Results Page:</b> $searchObj.hasNextPage()<br/>
    <b>Has Previous Results Page:</b> $searchObj.hasPreviousPage()<br/>
    <b>Estimated Total of Results:</b> $searchObj.estimatedTotal<br/>
    <br/>
    #foreach($result in $searchObj.searchResults)
    	<b>Result Index:</b> $result.resultIndex<br/>
    	<b>Identation Level:</b> $result.identationLevel<br/>
    	<b>Title:</b> $result.title<br/>
    	<b>Snippet:</b> $result.snippet<br/>
    	<b>Result URL:</b> <a href="$result.resultURL">$result.resultURL</a><br/>
    	<b>General Rating Relevance:</b> $result.generalRatingRelevance<br/>
    	<b>Mime Type:</b> $result.mimeType<br/>
    	<b>Additional Search Details:</b> $result.additionalSearchDetails<br/>
    	<b>Meta Tags Fields:</b> $result.metaTagsFields<br/>
    	<hr/>
    #end
    

    back to top
    Let you retrieve result from a google custom search.

    View Tool Syntax:

    $googleapi.searchGoogleCustom(client, query, start, num, autoFilter)
    
    Arguments:

    Usage:

    Use this to pull search results from a google custom search, to make this web api work you have to setup the variables GOOGLE_CUSTOM_SEARCH_URL and GOOGLE_CUSTOM_SEARCH_CSEID on the dotmarketing.config.properties file pointing to the google custom search url like GOOGLE_CUSTOM_SEARCH_URL=http://www.google.com and GOOGLE_CUSTOM_SEARCH_CSEID=xxxxxxxxxxxxxxxxxxxxx:yyyyyyyyyyy

    The api returns an specific GoogleMiniSearch object that contains all the variables necessary to display all the retrieved results.

    GoogleMiniSearch Object - Attributes

    	searchTime - The time taken by the appliance to retrieve the results
    query - The request query
    params - Hashmap with param names and values; contextTitle - String with the context title; fromIndex - The start index of results
    toIndex - The end index of retrieved results
    estimatedTotal - The estimated total of result based on the given query
    searchResults - The list of results, this is a list of GoogleMiniSearchResult objects
    hasNextPage() - Method that returns true if results has a next page to display
    hasPreviousPage() - Method that returns true if results has a previous page to display
    GoogleMiniSearchResult - Attributes
    	identationLevel - Level of indentation used for inner results
    mimeType - Mime type of the result
    resultURL - The url to the result
    title - The title
    generalRatingRelevance - Relevance of the document in google mini
    additionalSearchDetails - More details about the retrived document
    snippet - Result snippet
    metaTagsFields - A map of metatags associated to the result
    language - Language associated to the result
    label - Label associated to the result
    documentCacheSize - Document Cache Size associated to the result
    documentCacheId - Document Cache Id associated to the result

    Example:

    
    #set($searchObj = $googleapi.searchGoogleCustom("", "Knight", 0, 100, false))
    <b>Search Summary</b><br/>
    <b>Total Search time:</b> $searchObj.searchTime<br/>
    <b>Query:</b> $searchObj.query<br/>
    #foreach($param in $searchObj.params)
    	<b>Param Name:</b> $param.key<br/>
    	#foreach($paramValue in $param.value)
    		<b>$paramValue.key:</b> $paramValue.value<br/>
    		<hr/>
    	#end
    	<hr/>
    #end
    <b>From Index:</b> $searchObj.fromIndex<br/>
    <b>To Index:</b> $searchObj.toIndex<br/>
    <b>Estimated Total:</b> $searchObj.estimatedTotal<br/>
    <b>Has Next Results Page:</b> $searchObj.hasNextPage()<br/>
    <b>Has Previous Results Page:</b> $searchObj.hasPreviousPage()<br/>
    <b>Estimated Total of Results:</b> $searchObj.estimatedTotal<br/>
    <br/>
    #foreach($result in $searchObj.searchResults)
    	<b>Result Index:</b> $result.resultIndex<br/>
    	<b>Identation Level:</b> $result.identationLevel<br/>
    	<b>Title:</b> $result.title<br/>
    	<b>Snippet:</b> $result.snippet<br/>
    	<b>Result URL:</b> <a href="$result.resultURL">$result.resultURL</a><br/>
    	<b>General Rating Relevance:</b> $result.generalRatingRelevance<br/>
    	<b>Mime Type:</b> $result.mimeType<br/>
    	<b>Additional Search Details:</b> $result.additionalSearchDetails<br/>
    	<b>Meta Tags Fields:</b> $result.metaTagsFields<br/>
    	<hr/>
    #end
    

    back to top
    List of Files from Underlying File System This macro will return a list of files that are available in a folder on the underlying file system.

    Macro Syntax:

       #getFilesFromFS('path')
    
    Arguments:

    Usage:
    The repository will show a list of files in a folder on the underlying file system. WARNING: THIS MACRO BYPASSES THE CMS PERMISSIONS COMPLETELY.

    Example:

    #getFilesFromFS('/css')
    #foreach($file in $files)
       title: $!file.name 
    size : $!file.size
    prettySize : $!file.prettySize
    date : $!file.date
    prettyDate : $!file.prettyDate
    link: $!file.link
    #end
    This would build a list of file information found in the file system folder $WEB-ROOT/css.

    back to top
    Create the Login Form The macro create a form that let the user to login, retrieve their password or create a new account

    Macro Syntax:

       #loginForm()
    
    Optional Parameters:

    Example:

    #loginForm()
    

    Example: using the optional parameters. This example shows a "Create New Account" link under the Login button

    #set($loginFormShowRegistrationLink = true)
    #set($loginFormRegistrationLinkText = "Create new account")
    #loginForm()
    


    back to top
    Add map from Google Maps This macro generates a map from Google Maps and display a marker over the specified address.

    Macro Syntax:

    #googleMap($key)
    Arguments: Optional Parameters:

    back to top
    Add a direction map from Google Maps This macro generates a direction maps from Google Maps and display two markers one on the starting position and one on the ending position, and the directions how to arrive from the staring to the ending position. It also return a velocity variable $urlForPrint, a link that show the direction in print mode.

    Macro Syntax:

    #googleMapDirections($from,$to,$key)
    Arguments: Optional Parameters:

    back to top
    Mailing List Generated on a Web Form that Displays the Public Mailing Lists This macro generates a checkbox list for all public mailing lists, in order to manage the user's email subscriptions to these mailing lists. This macro can be used either the user is logged in or using encrypted user id when the user is not logged in.

    Macro Syntax:

    #mailingList()

    Usage:

    The macro will display all public mailing lists name

    Example: Let's assume we have a page with this macro, let's call it mailinglists_subscription.dot, if the user is logged in, this page can be accessed directly and its content will have the following macro call

          #mailingLists()

    Example2: The user is not logged in, but we can access the prior page passing through the respective encrypted userId using the respective request parameter

          mailinglists_subscription.dot?ui=UUZVXTMAEvP6ABUja7Rkhg==



    back to top
    Media Gallery
    The Media Gallery "macro" pulls and displays all the photos (jpgs and gifs files) and videos (flvs files) of a given folder, it also pulls and displays sub folders if they contain photos. If a JPG image with the same name as the video file is provided it will be displayed as a thumbnail of the video.

    Macro Syntax:

    #mediaGallery('/thefolder')
    Arguments: Optional Parameters:

    Usage:

    #set ($mediaWidth= "300")
    #set ($mediaHeight = "225")
    #set ($thumbnailWidth = "45")
    #set ($thumbnailHeight = "45")
    #set ($largeImageWidth = "400")
    #set ($largeImageHeight = "300")
    #set ($showMediaTitle = false)
    #set ($random = true)
    #set ($viewLargeImage = true)
    #set ($viewLargeImageLinkSpaceHeight = "40")
    #mediaGallery('/test/gallery')

    back to top
    MP3 Player This macro will embed a streaming, flash based mp3 player using mp3s files you have uploaded into dotCMS.  dotCMS will parse the xml file info and automatically display the song information in the player.

    Macro Syntax:

    #mp3Player('path')
    Arguments: Optional:

    Usage:

    This macro will automatically display the following mp3 player

    Example:

    #mp3Player('/path/to/mp3s/file.mp3')
    #mp3Player('/path/to/mp3s/playlist.xml')
    The file /path/to/playlist.xml needs to generate the following format:
    
    <?xml version="1.0" encoding="UTF-8"?>
    <playlist version="1" xmlns="http://xspf.org/ns/0/">
    <trackList>
    <track>
    <location>http://$!{host.getHostname}/mp3s/file1.mp3</location>
    <creator>File Creator 1</creator>
    <title>File Title #1</title>
    <genre>Other</genre>
    <image>http://$!{host.getHostname}/mp3s/file1.jpg</image>
    </track>
    <track>
    <location>http://$!{host.getHostname}/mp3s/file2.mp3</location>
    <creator>File Creator 2</creator>
    <title>File Title #2</title>
    <genre>Other</genre>
    <image>http://$!{host.getHostname}/mp3s/file2.jpg</image>
    </track>
    <track>
    <location>http://$!{host.getHostname}/mp3s/file3.mp3</location>
    <creator>File Creator 3</creator>
    <title>File Title #3</title>
    <genre>Other</genre>
    <image>http://$!{host.getHostname}/mp3s/file3.jpg</image>
    </track>
    </trackList>
    </playlist>
    
    
    back to top
    MP3 Player Button This macro will embed a streaming, flash based mp3 player button using mp3s files you have uploaded into dotCMS.

    Macro Syntax:

    #mp3PlayerButton('song_url')
    Arguments: Optional:

    Usage:

    This macro will automatically display the following mp3 player

    Example:

    #mp3PlayerButton('/path/to/mp3s/example.mp3')
    #mp3PlayerButton('/path/to/playlist.xml')
    The file /path/to/playlist.xml needs to generate the following format:
    
    <?xml version="1.0" encoding="UTF-8"?>
    <playlist version="1" xmlns="http://xspf.org/ns/0/">
    <trackList>
    <track>
    <location>http://$!{host.getHostname}/mp3s/file1.mp3</location>
    <creator>File Creator 1</creator>
    <title>File Title #1</title>
    <genre>Other</genre>
    <image>http://$!{host.getHostname}/mp3s/file1.jpg</image>
    </track>
    <track>
    <location>http://$!{host.getHostname}/mp3s/file2.mp3</location>
    <creator>File Creator 2</creator>
    <title>File Title #2</title>
    <genre>Other</genre>
    <image>http://$!{host.getHostname}/mp3s/file2.jpg</image>
    </track>
    <track>
    <location>http://$!{host.getHostname}/mp3s/file3.mp3</location>
    <creator>File Creator 3</creator>
    <title>File Title #3</title>
    <genre>Other</genre>
    <image>http://$!{host.getHostname}/mp3s/file3.jpg</image>
    </track>
    </trackList>
    </playlist>
    
    
    back to top
    MP3 Player Extended This macro will embed a streaming, flash based mp3 player button using mp3s files you have uploaded into dotCMS.

    Macro Syntax:

    #mp3PlayerExtended('song_url')
    Arguments: Optional:

    Usage:

    This macro will automatically display the following mp3 extended player

    Example:

    #mp3PlayerExtended('/path/to/mp3s/example.mp3')
    #mp3PlayerButton('/path/to/playlist.xml')
    The file /path/to/playlist.xml needs to generate the following format:
    
    <?xml version="1.0" encoding="UTF-8"?>
    <playlist version="1" xmlns="http://xspf.org/ns/0/">
    <trackList>
    <track>
    <location>http://$!{host.getHostname}/mp3s/file1.mp3</location>
    <creator>File Creator 1</creator>
    <title>File Title #1</title>
    <genre>Other</genre>
    <image>http://$!{host.getHostname}/mp3s/file1.jpg</image>
    </track>
    <track>
    <location>http://$!{host.getHostname}/mp3s/file2.mp3</location>
    <creator>File Creator 2</creator>
    <title>File Title #2</title>
    <genre>Other</genre>
    <image>http://$!{host.getHostname}/mp3s/file2.jpg</image>
    </track>
    <track>
    <location>http://$!{host.getHostname}/mp3s/file3.mp3</location>
    <creator>File Creator 3</creator>
    <title>File Title #3</title>
    <genre>Other</genre>
    <image>http://$!{host.getHostname}/mp3s/file3.jpg</image>
    </track>
    </trackList>
    </playlist>
    
    

    back to top
    My Groups This macro will display a list of the groups joined by a user in the CMS.

    Macro Syntax:

    #myGroups($user)
    Arguments: Optional:

    Example:

    #myGroups($user)
    
    This would display the groups of the user logged in.

    Example 2:

    #set($myGroupTitle= "<b>${user.fullName} Groups</b>")
    #myGroups($user)
    
    This would display the groups of the user logged in, but other header for the list.


    back to top
    Navigation/Menu Builder This macro will build a navigational menu using unordered lists sutiable for standard top or left-hand navigation. These lists can then be formated by css. The resulting code will look like (where the 2nd <li> is the active link).
    <ul>
    	<li><a href="/path/to/pageOrFolder">Menu item 1</a></li>
    	<li class="active"><a href="/path/to/pageOrFolder">Menu item 2</a></li>
    	<li><a href="/path/to/pageOrFolder">Menu item 3</a></li>
    </ul>

    Macro Syntax:

    #navigation(startLevel levelsToShow)
    Arguments: Optional:
  • menuSpans
    If the $menuSpans variable is set to true before the macro is called, then <span> tags will be added around each menu link, like:
    <li><span><a href="/path/to/pageOrFolder">Menu item 1</a></span></li>
  • openAllLevels
    If this variable is set all menu items will be displayed on the navigation with no regard to where the user is on the site. This is very useful for top navigation drop downs that need to show all links.
  • firstItemClass
    CSS class to be included on every first item of a menu ul.
  • lastItemClass
    CSS class to be included on every first item of a menu ul.
  • menuIdPrefix
    Prefix to be prepend to every id on the generated navigation menu.
  • navigationSourceCode
    Render another html code to show the menu if wanted. When creating your own source code consider this information: The menu items will be a list saved in this variable $navigationItems. Each item in that list will contain the following Attribute or attribute (information), depending the type of item:

    Type FOLDER
    Attribute="type" value="FOLDER"
    Attribute="title" String
    Attribute="name" String
    Attribute="path" String
    Attribute="submenu" ArrayList of the next level
    Attribute="isFirstItem" Boolean
    Attribute="isLastItem" Boolean

    Type CODED LINK
    Attribute="type" value="LINK"
    Attribute="path" String
    Attribute="linkType" value="CODE"
    Attribute="isFirstItem" Boolean
    Attribute="isLastItem" Boolean

    Type LINK
    Attribute="type" value="LINK"
    Attribute="name" String
    Attribute="protocal" String
    Attribute="target" String
    Attribute="title" String
    Attribute="isFirstItem" Boolean
    Attribute="isLastItem" Boolean

    Type HTMLPAGE
    Attribute="type" value="HTMLPAGE"
    Attribute="name" String
    Attribute="path" String
    Attribute="title" String
    Attribute="isFirstItem" Boolean
    Attribute="isLastItem" Boolean

    Type FILE
    Attribute="type" value="FILE"
    Attribute="name" String
    Attribute="path" String
    Attribute="title" String
    Attribute="isFirstItem" Boolean
    Attribute="isLastItem" Boolean
  • Syntax:


    #navigation(startLevel levelsToShow)

    Example 1:

    <div id="topNav">
       #navigation(1,1)
    </div>
    
    This would build a top level menu one level deep.

    Example 2:

    <div id="leftNav">
       #navigation(2,2)
    </div>
    
    This would build a navigation bar 2 levels deep, which would open as the user clicked into a subsection.

    Example 3:

    <div id="leftNav">
    #set($menuSpans = true)
    #navigation(2,2)
    </div>
    
    This would build a navigation bar 2 levels deep, which would open as the user clicked into a subsection. It will also add span tags around all links.

    Example 4:

    <div id="leftNav">
    #set($openAllLevels=true)
    #navigation(2,2)
    </div>
    
    This would build a navigation bar 2 levels deep, which would open as the user clicked into a subsection.

    Example 5:

    <div id="leftNav">
    #set ($navigationSourceCode = '/my_velocity_files/my_navigation.vtl')
    #navigation(2,2)
    </div>
    
    This would build a navigation with your own source code.


    back to top
    Paging Contents Any list of contents in the content database can be pulled and displayed in a paginated fashion on the front end of your website by using the #pageContent() macro

    Macro Syntax:

    #pageContent('query' 'sort by' '# per page' '# current page')
    Arguments:

    Usage:

    This macro returns a list of content(s) on a variable named $list of contentlets $content. The contentlet's properties can be displayed by referencing their variable names. So $content.firstName would display the variable named firstName for the listed contents. The variable name can be found in the structure detail for the content type being used.
    If you need to add a link to a content detail page you will need to use the content's inode by adding this variable: $content.inode.
    Also, there are a group of variables set by this macro that help you know things like $totalResults that contains the total number of contents, $totalPages for the total number of pages, $firstPageRecord for the first record number of the current page, $lastPageRecord for the last record number of the current page, $hasNextPage true if has a next page, $hasPreviousPage true if has a previos page

    Example:

    #pageContent('+type:content +live:true +structureInode:5' 'date1' '5' '1')
    #foreach($content in $list)
    title: $!content.contentTitle
    summary: $!content.NewsSummary
    #end

    back to top
    PDF Export Creates an icon that exports the current page as a PDF document

    Macro Syntax:

    #pdfExport()
    Optional Parameters:

    Usage:

    Example:

    #pdfExport()

    Example with optional parameters:

    #set($pdfFileName='My PDF Title')
    #set($pdfExportIcon='/html/images/icons/pdf.gif')
    #set($pdfExportAltText='Create PDF document')
    #pdfExport()

    back to top
    Permanent Link to a File, Page, or Contentlet This macro create a permanent link to a File, Page or Contentlet from the identifier or inode of them and add the trackback RDF reference to the page.
    In the case where the identifier is from a contentlet, you could include which page you want to display the contentlet information, adding the page identifier in the optional parameter "permalinkDetailPage", if this parameter is not pass, the macro will look if the contentlet structure have a detail page set, using this page if this page is not set then use the same page where the permalink is include adding in the url the ?id param with the identifier.

    Macro Syntax:

    #permalink(identifier)
    Arguments:

    Usage:

    Example:

    #permalink('12345')


    Example2:

    #set($permalinkDetailPage='78945') #permalink('12345')


    Example3:

    #set($permalinkTitle ="The Title") #permalink('12345')



    back to top
    Subscribe to public Mailing Lists This macro generates a checkbox list for all public mailing lists, in order to manage the user's email subscriptions to these mailing lists. The big difference between this macro the mailing lists macro is that this macro does not require the user to be logged in, the form request the user email address and it validates if a user with that email address exists if it doesn't then it creates the user and then execute the mailing list subscriptions

    Macro Syntax:

    #subscribe()
    Optional Parameters:

    Usage:

    The macro will display all public mailing lists as checkboxes plus fields for the user email address, first name and last name. If an email address is passed to the page as a request parameter, named email, the macro will match the given email address with the current email subscriptions pre-checking the mailing lists that the user is already subscribed.
    When the form is submitted the email address is checked to see if the user already exists in the system, if no user exists then a user is created, subsequently the user is associated with the selected mailing lists.
    The form generates at the end a special checkbox for the user to subscribe to the "do not send me any emails" list.

    back to top
    Permanent Link Trackback: Add RDF Trackback to a File, Page or Contentlet This macro create the RDF tracback reference in the page for a permanent link to a file, page or contentlet in the case of the contentlet it check if receive a parameter called "permalinkDetailPage" that is the inode or identifier of the content page detail. If not, check if the struture have a page default or return to the same page adding the parameter

    Macro Syntax:

    #trackback(identifier)
    Arguments:

    Usage:

    Example:

    #trackback('12345')



    back to top
    Photo Carousel This macro generates a carousel of photos, displaying sequentially one after another.

    Macro Syntax:

    #photoCarrousel (photoList photoDimensions)
    Arguments: Optional Parameters:

    Usage:

    The macro will display a carrousel of photos

    Example 1: This show a simple way to call the macro setting the image folder

    #set($imageFolder = '/global/images/screencaps/')
    #set($photoDimensions = $contents.getEmptyMap())
    #set($dummy = $!photoDimensions.put("width", "125"))
    #set($dummy = $!photoDimensions.put("height", "125"))
    #set($photoCarrouselAutoSlide = true)
    #set($photoList = $contents.getEmptyList())
    #photoCarrousel($photoList $photoDimensions)
    

    Example 2: This show a simple way to call the macro with the photo list fields

    #set($photoList = $contents.getEmptyList())
    #set($photo = $contents.getEmptyMap())
    #set($dummy = $!photo.put("url", "/html/1.jpg"))
    #set($dummy = $!photo.put("link", "http://www.yahoo.com"))
    #set($dummy = $!photoList.add($photo))
    #set($photo = $contents.getEmptyMap())
    #set($dummy = $!photo.put("url", "/html/2.jpg"))
    #set($dummy = $!photo.put("link", "http://www.google.com"))
    #set($dummy = $!photoList.add($photo))
    #set($photo = $contents.getEmptyMap())
    #set($dummy = $!photo.put("url", "/html/3.jpg"))
    #set($dummy = $!photo.put("link", "http://www.dotcms.org"))
    #set($dummy = $!photoList.add($photo))
    #set($photo = $contents.getEmptyMap())
    #set($dummy = $!photo.put("url", "/html/4.jpg"))
    #set($dummy = $!photo.put("link", "http://www.hotmail.com"))
    #set($dummy = $!photoList.add($photo))
    #set($photoDimensions = $contents.getEmptyMap())
    #set($dummy = $!photoDimensions.put("width", "125"))
    #set($dummy = $!photoDimensions.put("height", "125"))
    #set($photoCarrouselAutoSlide = true)
    #photoCarrousel($photoList $photoDimensions)
    

    Example 3: This show a simple way to call the macro with the photo list fields and showing captions

    #set($photoList = $contents.getEmptyList())
    #set($photo = $contents.getEmptyMap())
    #set($dummy = $!photo.put("url", "/html/1.jpg"))
    #set($dummy = $!photo.put("link", "http://www.yahoo.com"))
    #set($dummy = $!photo.put("caption", "Yahoo"))
    #set($dummy = $!photoList.add($photo))
    #set($photo = $contents.getEmptyMap())
    #set($dummy = $!photo.put("url", "/html/2.jpg"))
    #set($dummy = $!photo.put("link", "http://www.google.com"))
    #set($dummy = $!photo.put("caption", "Google"))
    #set($dummy = $!photoList.add($photo))
    #set($photo = $contents.getEmptyMap())
    #set($dummy = $!photo.put("url", "/html/3.jpg"))
    #set($dummy = $!photo.put("link", "http://www.dotcms.org"))
    #set($dummy = $!photo.put("caption", "dotCMS"))
    #set($dummy = $!photoList.add($photo))
    #set($photo = $contents.getEmptyMap())
    #set($dummy = $!photo.put("url", "/html/4.jpg"))
    #set($dummy = $!photo.put("link", "http://www.hotmail.com"))
    #set($dummy = $!photo.put("caption", "HotMail"))
    #set($dummy = $!photoList.add($photo))
    #set($photoDimensions = $contents.getEmptyMap())
    #set($dummy = $!photoDimensions.put("width", "125"))
    #set($dummy = $!photoDimensions.put("height", "125"))
    #set($photoCarrouselAutoSlide = true)
    #photoCarrousel($photoList $photoDimensions)
    


    back to top
    Photo Gallery
    The Photo Gallery "macro" pulls and displays all the photos (jpgs and gifs files) of a given folder, it also pulls and displays sub folders if they contain photos.

    Macro Syntax:

    #photoGallery('/thefolder')
    Arguments: Optional Parameters:

    Usage:

    Let say you have a folder structure like the following:

    /photo_galleries -> folder where resides photos and sub galleries
    /photo_galleries/photo1.jpg -> image of this top level gallery
    /photo_galleries/photo2.jpg -> image of this top level gallery
    /photo_galleries/gallery_1 -> folder where the first gallery resides
    /photo_galleries/gallery_1/index.jpg -> main image of this gallery
    /photo_galleries/gallery_1/XXX.jpg -> any other image of this gallery
    ...
    /photo_galleries/gallery_2 -> folder where the second gallery resides
    /photo_galleries/gallery_2/index.jpg -> main image of this gallery
    /photo_galleries/gallery_2/XXX.jpg -> any other image of this gallery
    ...

    So calling,
    #photoGallery('/photo_galleries')
    Will display photo1 and photo2 as photos located in the /photo_galleries folder and then will list gallery1 and gallery2 as sub photo galleries of the /photo_galleries folder, the index.jpg (or index.gif) images are used as the main images when sub photo galleries thumbnails are shown, if the subfolder doesn't contain an index image then the first image found in the folder will be used as the index image.

    To use the optional parameters you have to set them before the macro is called. E.G.
    #set($showPhotoTitle = false)
    #photoGallery('/photo_galleries')

    back to top
    Print Average Content Rating Prints out the average rating calculated by the dotCMS from the rating votes. It prints out the average rating formatted with two decimals. I.E. X.XX

    Macro Syntax:

    #printAverageRating(content_identifier)
    Arguments:

    Usage:

    Example:

    	#printAverageRating($content.identifier)
    



    back to top
    Print the Number of Votes of a Rated Content Prints out the number of votes of a content

    Macro Syntax:

    #printNumberOfVotes(content_identifier)
    Arguments:

    Usage:

    Example:

    	#printNumberOfVotes($content.identifier)
    



    back to top
    Pull RSS Feed This macro will retrieve a poll list is no questionId is set or a poll question to vote or a poll results

    Macro Syntax:

    #poll('questionId')
    Arguments:

    Usage:

    Example:

    This example returns a list with the active poll.
    #poll('')

    Example 2:

    This example returns a poll question id to vote.
    #poll('123')

    Example3:

    This example returns a poll question id to vote. In this case the user could see the results without voting
    #set($allowViewResults = true)
    #poll('123')

    Example4:

    This example returns the poll questions from the group id 12345
    #set ($portletGroupIds = $contents.getEmptyList())
    #set ($_dummy = $portletGroupIds.add('12345'))
    #poll('')

    back to top
    Pull RSS Feed This macro will retrieve a RSS Feed and will return it in a list

    Macro Syntax:

    #pullRSSFeed('url')
    Arguments:

    Usage:

    This macro returns a list with the RSS Feed. the macro will return the data in a variable called $list of contentlets $content.The contentlet's properties can be displayed by referencing their variable names. So $content.title would display the RSS entry title. there are four variable:
    title
    link
    description
    pubDate

    Example:

    #set($rssFilter = ['dotcms','dotmarketing'])
    #set($rssTotal = 10)
    #pullRSSFeed('http://somesite/topnews.rss')
    #foreach($content in $list)
    title: $!content.title
    description: $!content.description
    #end

    back to top
    Pulling Content Any content or list of content in the content database can be pulled and displayed on the front end of your website by using the #pullContent() macro.

    Macro Syntax:

    #pullContent('query' '# results' 'sort by')
    Arguments:

    Usage:

    This macro returns a list or a single piece of content. If you specified more than one result you will have a variable named $list of contentlets $content. If you specified one piece of content, you can ignore the list and just use the $content variable. The contentlet's properties can be displayed by referencing their variable names. So $content.firstName would display the variable named firstName for the listed contents. The variable name can be found in the structure detail for the content type being used.
    If you need to add a link to a content detail page you will need to use the content's inode by adding this variable: $content.inode

    Example 1: This pulls a list of 5 content objects with structure inode 5 ordered by date1, and it displays the title and summary of each one.

    #pullContent('+type:content +live:true +structureInode:5' '5' 'date1')
    #foreach($content in $list)
    title: $!content.contentTitle
    summary: $!content.NewsSummary
    #end

    Example 2: This pulls a list of 1 random content objects with structure inode 5, and it displays the title and summary of each one.

    #pullContent('+type:content +live:true +structureInode:5' '1' 'random')
    #foreach($content in $list)
    title: $!content.contentTitle
    summary: $!content.NewsSummary
    #end

    back to top
    Pulling and Displaying Related Content (Relationships) Any related content (driven by structure relationships) can be pulled and displayed on the front end of your website by using the #pullRelatedContent() macro.

    Macro Syntax:

    #pullRelatedContent('relationship name' 'content inode' 'limit' 'sort by')
    Arguments:

    Usage:

    This macro returns a list of related content. After the macro is called you will have a variable named $list of content objects. The content's properties can be displayed by referencing their variable names. So $content.firstName would display the variable named firstName for the listed contents. The variable name can be found in the structure detail for the content type being used.
    If you need to add a link to a content detail page you will need to use the content's inode by adding this variable: $content.inode

    Example 1: This pulls a list of up to 100 content related to content with identifier 4686 that is related through relationship: Annual_Report_Article-Audio and it orders it by Headline, Text and Modified Date

    #pullRelatedContent('Annual_Report_Article-Audio' '4686' '100' 'fullHeadline asc, bodyText desc, modDate')
    
    #foreach($content in $list)
    headline: $!content.fullHeadline
    body: $!content.bodyText
    #end

    Example 2: This pulls a list of up to 100 content related to content with identifier 4686 that is related through relationship: Annual_Report_Article-Audio and it orders it by Headline, Text and Modified Date. This only pulls content that match the condition where the Headline starts with the word "test".

    #set ($condition = '+fullHeadline:test*')
    #pullRelatedContent('Annual_Report_Article-Audio' '4686' '100' 'fullHeadline asc, bodyText desc, modDate')
    
    #foreach($content in $list)
    headline: $!content.fullHeadline
    body: $!content.bodyText
    #end

    back to top
    Random Image: Return a random image from a specified folder You must provide to this macro a path in order in order to return a random image

    Macro Syntax:

    #randomImage (path)
    Arguments:

    Usage:

    The macro will return the image selected in the variable $image

    Example:

    #set ($path = '/global/images/')
    #randomImage($path)
    <img src="/resize_image?inode=$!{image.inode}&w=911&h=322" alt="Top Banner" width="911" height="322" />
    



    back to top
    Retrieve Selected Inode Gets the inode selected by the user. Typically this will be used in 'detail' style pages (e.g. /news/details.dot), and therefore the inode will actually correspond to a selected contentlet. Note that the name of the request parameter used for extracting the selected inode, is determined by the properties key "INODE_PARAMETER_NAME". In case this key is missing, the parameter name defaults to "inode"

    Macro Syntax:

    #selectedInode()

    Usage:

    The macro will get the passed in inode for you

    Example:

    #selectedInode()


    back to top
    Send To Friend This macro generates a form to send an article to a friend by email.

    Macro Syntax:

    #sendtofriend (articleText)
    Arguments: Optional Parameters:

    Usage:

    The macro will display a send to friend form

    Example: This shows a simple way to call the macro with the required fields

    #set($sendToFriendStyle = "display:inline;")
    #sendtofriend('This is a Send To Friend test!!!')

    Example: This example call the macro with a template and with some custom parameters

    <!--Create the hashmap-->
    #set($parameters = $contents.getEmptyMap())
    <!--Set the parameters-->
    #set($dummy = $parameters.put('eventId',$eventId))
    #set($dummy = $parameters.put('eventTitle',$content.title))
    #set($dummy = $parameters.put('eventSubtitle',$content.subtitle))
    #set($dummy = $parameters.put('eventDescription',$content.description))
    #set($dummy = $parameters.put('eventImage',$content.largeImage))
    #set($dummy = $parameters.put('eventStartDate',$UtilMethods.dateToHTMLDate($content.startDate,'hh:mm a')))
    <!--Set the template-->
    #set($emailTemplate = "/calendar/sendfriendemailtemplate.dot")
    <!--Call the macro-->
    #set($sendToFriendStyle = "display:inline;")
    #sendtofriend('This is a Send To Friend test!!!')
    


    back to top
    Site Map: Add a Site Map to a Page.

    Macro Syntax:

       #sitemap()
    

    Usage:
    Use this macro if you want to add a site map for your whole site.

    Optional Parameters:
  • reverseOrder (velocity variable not a parameter)
    Set this boolean to true to return the Site Map ordered descending. Default: false.
  • showHome
    Set to true if you want to display a link to Home Page
  • siteMapIdPrefix
    Prefix to be prepend to every id on the generated sitemap.
  • Example:

    #sitemap() This would build a site map for everything from the root fo the site. It will stop at 100 levels deep.

    back to top
    Site Map Folder: Add a Site Map to a Page from a Folder to a Specific Depth.

    Macro Syntax:

    #siteMapFolder(2,2,'/folder1/myFolder')
    
    Arguments:

    Usage:
    Use this macro if you want to add a site map to your page from a specific path. You can specify how many level from the path to start and end.

    Example:

    #siteMapFolder(2,2,'/folder1/myFolder')
    
    This would build a site map for everything 2 levels beneath /folder1/myFolder and go 2 levels deep.



    Example2:

    #set($reverseOrder = true)
    #siteMapFolder(2,2,'/folder1/myFolder')
    
    This would build a site map for everything 2 levels beneath /folder1/myFolder and go 2 levels deep in inverse order.

    Example3:

    #set($showHome = true)
    #siteMapFolder(2,2,'/folder1/myFolder')
    
    This would build a site map for everything 2 levels beneath /folder1/myFolder and go 2 levels deep adding a link called: Home linked to the site's Home Page.


    back to top
    Slide Show: Add a Flash Slide Show to display a set of 'Slide Image' related to a 'Slide Show' content.

    Macro Syntax:

    #slideshow(title)
    
    Arguments:

    Usage:
    Use this macro if you want to add a flash slide show of a set of related images.

    Example:

    #slideshow('Slide Show Content Title')
    
    This bring all the 'Slide Image' related to the 'Slide Show' content with title 'Slide Show Content Title'.


    back to top
    Social Bookmarks This macro generates bookmark links to the most popular social bookmarking sites such as Digg, Del.icio.us or Reddit, you can choose from more than 10 different sites.
    Available sites: blinkbits, blinklist, blogmarks, co.mments, connotea, del.icio.us, digg, google, newsvine, reddit, spurl, stumble upon, technorati, wists, yahoo.

    Macro Syntax:

    #socialBookmarks()
    
    Arguments: Optional Arguments:

    Usage:

    The macro will generate the links to the chosen sites, given a list of the different bookmarking sites you wish to include.

    Example 1:

    #set ($onlyIcons = "true")
    #set ($socialBookmarksList = ['digg','delicious','yahoo','google','newsvine'])
    #set ($socialBookmarksShareIcon = "/test/bookmark_icon.gif")
    #socialBookmarks()


    Example 2:

    #set ($socialBookmarksList = ['digg','delicious','yahoo','google','newsvine'])
    #set ($socialBookmarksSourceCode = '/my_velocity_files/my_bookmarks.vtl')


    back to top
    Submit Content This macro allow to create content for a particular structure in the Front-End, for the user's that have publish permission over the structure for some role. This macro could be use with captcha validation, creation of a work flow task to a particular role moderator and auto publish content, it is necessary.
    If the structure have a required relationship condition the Webmaster should add $relationship_name variable with the identifier of the other contentlet that want to use.
    If the user wants to use a different default field value could add a $default<Velocity field name>.

    Macro Syntax:

    #submitContent('Structure name')
    Arguments: Optional Parameters:

    Usage:
    Use this macro if you want to add a form to create a contentlet for a particular structure, the macro, will add a form to add new contentlet.

    Example 1: This example generate a News content.

    #submitContent("News") 

    Example 2: This example generate a News content with: image captha validation and a workflow task, modify the default value for the title field and add two required relationship to the contentlet with the comment structure.

    #set($contentUseCaptcha = true)
    #set($contentModeration= 'Report User')
    #set($defaultTitle = 'TEST TITLE')
    #set($News-Comments = ['321229','321231'])
    #submitContent("News")

    Example 3: This example generate a News content with: audio captcha validation, content auto publish, showing only the required fields, hidden the info, test and photo fields, and modifying the default description field value,.

    #set($contentUseCaptcha = true)
    #set($contentUseAudioCaptcha = true)
    #set($contentAutoPublish = true)
    #set($showOnlyRequiredFields = true)
    #set($dontShowFields = ['info','test','photo'])
    #set($defaultDescription = 'TEST Description')
    #submitContent("News")


    back to top
    Generates a Tag Cloud Based on Used Content Tags This macro generates a list of tag links with all the tags used on the content of the given structures, every link generated is associated one of the following css classes [xSmallTag, smallTag, mediumTag, largeTag, xLargeTag] depending on the usage of the tag.

    Macro Syntax:

    #tagCloud(structureNames url maxNumberOfTags)
    Arguments: Optional Arguments:

    Example 1:

    #tagCloud(["White Papers", "Blogs", "Testimonial"] '/mypage.dot' 40)


    Example 2:

    #set($ignoredTags = ["tag1", "tag2"])

    #tagCloud(["White Papers", "Blogs", "Testimonial"] '/mypage.dot' 40)



    back to top
    Create a text area for a form. This is needed so you can create a text area in the backend of the dotcms.

    Macro Syntax:

    #textArea(name style)
    Arguments: Optional Arguments:

    Example 1:

    #textArea($myName "width:200px")


    Example 2:

    #set($id = "myID")

    #set($value = $myValue)

    #textArea("myName" "width:200px")



    back to top
    Title Generator This macro will create an image with the title sent as parameter.

    Macro Syntax:

       #titleImage('title')
    
    Arguments: Optional Parameters:

    Example:

       #set ($font = 'tahoma')
       #set ($size = '20')
       #set ($color = '30,30,30')
       #titleImage('Test Title')
    

    Example 2:

       #set ($font = 'tahoma')
       #set ($size = '20')
       #set ($color = '30,30,30')
       #set ($background = "transparent")
       #titleImage('firstString&secondString')
    

    Example 3:

       #set ($font = 'tahoma')
       #set ($size = '20')
       #set ($color = '30,30,30')
       #set ($background = "255,255,255")
       #titleImage('firstString')
    

    back to top
    Video Gallery This macro pulls all FLV files from a folder and displays a flash video player for each video. If a JPG image with the same name as the video file is provided it will be displayed as a thumbnail of the video.

    Macro Syntax:

    #videoGallery(url)
    Arguments: Optional:

    Usage:

    The macro will create a video gallery of all videos in the folder: /videos/.

    Example:

    #videoGallery('/videos/')

    Example2:

    #set($showVideoTitle = false)
    #set($showVideoDescription = false)
    #videoGallery('/videos/')
    
    This will display the video gallery with no titles and no descriptions for each video.

    Example3:

    #set($w = 200)
    #set($h = 200)
    #videoGallery('/videos/')
    
    This will display the video gallery with image thumbnails of 200 x 200.

    Example4:

    #set($galleriesToShow = 2)
    #videoGallery('/videos/')
    
    This will display the video gallery with only two videos at a time, it will display links to Next and Previous to view the rest.



    back to top
    Video Player: Play Video in a Flash Video Player You can provide this macro a URL to a .flv file and it will provide a player for your video.

    Macro Syntax:

    #videoPlayer(url)
    Arguments: Optional Parameters:

    Usage:

    The macro will play the video within an embedded flash player

    Example:

    #videoPlayer('/global/videos/myvideo.flv')


    Example2:

    #set($width = '500')
    #set($height = '500')
    #set($autostart = 'true')
    #set($backgroundColor = '#000000')
    #set($scale = 'default')
    #videoPlayer('/global/videos/myvideo.flv')