Velocity Viewtools

Viewtools are Java classes that encapsulate functionality and are exposed to Velocity. All Velocity contexts have access to use Viewtools. Viewtools are mapped to a key in velocity in the toolbox.xml file, which is loaded at startup. Viewtools can also be mapped dynamically, using OSGI.

Viewtools are important for web developers to understand as they provide access to the dotCMS content repository along with a huge amount of methods and utilities that help with functions such as String formatting, date formatting and calculation, XML/JSON manipulation, floating point math, and other functions often needed when building the display layer.

Viewtools allow Java developers to build custom APIs and Java classes that integrate and encapsulate business systems and functionality for use by the web development team.

List of Viewtools#


NameDescription
Dotcontent ViewtoolThe $dotcontent Velocity Viewtool is used to pull individual content items or lists of content from the content repository via Velocity, using Lucene queries.
Dotcache ViewtoolThe $dotcache Velocity Viewtool allows temporary storage of generic object data.
Logger ViewtoolThe $dotlogger viewtool enables you to write messages to the dotCMS log files from your Velocity code.
Alternator ViewtoolAn Alternator is an iterator to alternate between a couple values or even a list, if it reaches the end of the list, it will start over again at zero.
Categories ViewtoolThe Categories Viewtool provides methods to pull category information and related categories.
Contents ViewtoolThe Contents Velocity Viewtool provides methods for returning content, content properties, and content-related data.
CookieTool ViewtoolThe Cookietool Velocity Viewtool allows you to create and access cookies. This class is only designed for use as a request-scope tool.
Crypt ViewtoolThe Crypt Velocity Viewtool encrypts and decrypts text using public key encryption (PublicEncryptionFactory) methods.
Date ViewtoolThe Date Velocity Viewtool provides methods to manipulate and display dates and times in Velocity.
Elasticsearch ViewtoolThe Elasticsearch viewtool allows a Widget to perform an Elasticsearch query (using full Elasticsearch JSON syntax) and return a list of results which you can iterate over using Velocity.
EscapeTool ClassThe EscapeTool allows escaping in Velocity templates. It provides methods to escape outputs for Java, JavaScript, HTML, XML and SQL.
MathToolThe MathTool viewtool provides methods to perform floating point math in Velocity. It utilizes the java.lang.Math class to perform calculations.
FolderWebAPIThe FolderWebAPI is a Velocity viewtool which provides methods for displaying folders and folder properties, including menu items within the directory.
ImportToolThe Import Tool is a general-purpose text-importing viewtool, which allows you to import the contents of a text file into your page.
JSON ViewtoolThe JSONTool allows you to call local or remote json-based RESTful web services and parse the results for inclusion in a velocity template, page or widget.
TextTool (Language Viewtool)The TextTool Velocity viewtool allows you to access the values of dotCMS Language variables from within your Velocity code.
ListToolThe ListTool extends java.lang.Object and is a viewtool for working with Lists and arrays in Velocity templates.
LoopToolAn Apache convenience velocity tool to use with #foreach loops. It wraps a list with a custom iterator to provide additional controls and feedback for managing loops.
Mailer ViewtoolThe mailer tool is a simple email sender viewtool for dotCMS.
Markdown ViewtoolThis dotCMS viewtool provides a github flavored markdown (gfm) compatible markdown parser (for the most part).
Message ToolThe Message Tool ($messagetool) allows control of a class of small notification messages sometimes referred to as "toast messages," or simply "toasts."
NavTool ViewtoolThe $navtool Velocity viewtool allows you to create custom navigations with your own HTML and styles.
NumberToolTool for working with Number in Velocity templates. It is useful for accessing and formatting arbitrary Number objects.
ParserTool ClassThe ParserTool is a utility class for easy parsing of String values held in a Map.
Persona ViewtoolThe persona tool is a ....
PluginWebAPIThe PluginWebAPI is a tool that provides methods to find, initialize, and load plugins.
RenderToolThe Render tool exposes methods to evaluate the given strings as VTL (Velocity Template Language) and automatically using the current context.
Secrets ViewtoolThe $dotsecrets Viewtool allows passing of a secret string or character array — such as a token, key, password, etc. — via Velocity, without including sensitive data in the VTL file.
SiteSearch ViewtoolThe Site Search viewtool allows you to search for files, pages, and content on a SiteSearch index, and list all available SiteSearch indices.
Sorter ViewtoolThe sorter (SortTool) allows a user to sort a collection (or array, iterator, etc) on any arbitrary set of properties exposed by the objects contained within the collection.
SQL ViewtoolThe SQL Viewtool can be used for READ ONLY queries to a configured database(s).
User Agent ViewtoolThe User AgentTool is a viewtool for getting user agent information from within Velocity code.
CMSUser ViewtoolThe CMSUser Velocity Viewtool allows velocity access to the logged in user object and user properties.
UtilMethodsUtilMethods is a helper class providing many different methods that handle, verify or format many data structures — such as getting, evaluating, and comparing strings; dates and times; and a variety of other object types.
VelocityWebUtilThe VelocityWebUtil is a helper class that helps to determines whether velocity resources/files exist.
Website ViewtoolThe Website viewtool is a helper tool that helps to retrieve path elements — hosts, folders, or subfolders — for a site.
Workflow ViewtoolThe Workflow Viewtool, or just $workflowtool, is a Velocity Viewtool used to perform workflow actions on content in the system — whether saving, publishing, archiving, or any of a variety of other operations.
XMLToolThe XMLTool viewtool can be used to parse an remote XML file and iterate over each object returned in the XML file as needed.
XSLTToolThe XSLTTool provides a way to read from an XML source while providing XSLT transformation styling.
XssToolWhen displaying user data in our HTML Pages all tags and quotes should be striped of potentially harmful code and scripts in order to avoid cross site scripting (XSS) attacks.
Deprecated ViewtoolsThere are many viewtools that are deprecated. This means that we no longer support them and no longer recommend using them.