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#
Name | Description |
---|---|
Dotcontent Viewtool | The $dotcontent Velocity Viewtool is used to pull individual content items or lists of content from the content repository via Velocity, using Lucene queries. |
Dotcache Viewtool | The $dotcache Velocity Viewtool allows temporary storage of generic object data. |
Logger Viewtool | The $dotlogger viewtool enables you to write messages to the dotCMS log files from your Velocity code. |
Alternator Viewtool | An 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 Viewtool | The Categories Viewtool provides methods to pull category information and related categories. |
Contents Viewtool | The Contents Velocity Viewtool provides methods for returning content, content properties, and content-related data. |
CookieTool Viewtool | The Cookietool Velocity Viewtool allows you to create and access cookies. This class is only designed for use as a request-scope tool. |
Crypt Viewtool | The Crypt Velocity Viewtool encrypts and decrypts text using public key encryption (PublicEncryptionFactory) methods. |
Date Viewtool | The Date Velocity Viewtool provides methods to manipulate and display dates and times in Velocity. |
Elasticsearch Viewtool | The 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 Class | The EscapeTool allows escaping in Velocity templates. It provides methods to escape outputs for Java, JavaScript, HTML, XML and SQL. |
MathTool | The MathTool viewtool provides methods to perform floating point math in Velocity. It utilizes the java.lang.Math class to perform calculations. |
FolderWebAPI | The FolderWebAPI is a Velocity viewtool which provides methods for displaying folders and folder properties, including menu items within the directory. |
ImportTool | The Import Tool is a general-purpose text-importing viewtool, which allows you to import the contents of a text file into your page. |
JSON Viewtool | The 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. |
ListTool | The ListTool extends java.lang.Object and is a viewtool for working with Lists and arrays in Velocity templates. |
LoopTool | An 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 Viewtool | The mailer tool is a simple email sender viewtool for dotCMS. |
Markdown Viewtool | This dotCMS viewtool provides a github flavored markdown (gfm) compatible markdown parser (for the most part). |
Message Tool | The Message Tool ($messagetool ) allows control of a class of small notification messages sometimes referred to as "toast messages," or simply "toasts." |
NavTool Viewtool | The $navtool Velocity viewtool allows you to create custom navigations with your own HTML and styles. |
NumberTool | Tool for working with Number in Velocity templates. It is useful for accessing and formatting arbitrary Number objects. |
ParserTool Class | The ParserTool is a utility class for easy parsing of String values held in a Map. |
Persona Viewtool | The persona tool is a .... |
PluginWebAPI | The PluginWebAPI is a tool that provides methods to find, initialize, and load plugins. |
RenderTool | The Render tool exposes methods to evaluate the given strings as VTL (Velocity Template Language) and automatically using the current context. |
Secrets Viewtool | The $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 Viewtool | The Site Search viewtool allows you to search for files, pages, and content on a SiteSearch index, and list all available SiteSearch indices. |
Sorter Viewtool | The 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 Viewtool | The SQL Viewtool can be used for READ ONLY queries to a configured database(s). |
User Agent Viewtool | The User AgentTool is a viewtool for getting user agent information from within Velocity code. |
CMSUser Viewtool | The CMSUser Velocity Viewtool allows velocity access to the logged in user object and user properties. |
UtilMethods | UtilMethods 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. |
VelocityWebUtil | The VelocityWebUtil is a helper class that helps to determines whether velocity resources/files exist. |
Website Viewtool | The Website viewtool is a helper tool that helps to retrieve path elements — hosts, folders, or subfolders — for a site. |
Workflow Viewtool | The 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. |
XMLTool | The XMLTool viewtool can be used to parse an remote XML file and iterate over each object returned in the XML file as needed. |
XSLTTool | The XSLTTool provides a way to read from an XML source while providing XSLT transformation styling. |
XssTool | When 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 Viewtools | There are many viewtools that are deprecated. This means that we no longer support them and no longer recommend using them. |