Author: "dotcms"

Ace Editor Custom Field

The Ace text editor is an online code editor written in JavaScript. It matches the features and performance of native editors.

This code example...

How to Display Content Type's Fields

On this example we will show how to use Velocity to display the values for each type of field on a content type.

We created a new structure and...

Set Language by Site or Folder

dotCMS supports a robust set of multi-lingual features that can be used anywhere on sites served by dotcms by passing a url parameter -

com.dotmarketing...

One liner for generating OSGi fragment export

When developing an OSGI plugin, you often (always) need to generate an OSGi "fragment" which takes the place of manually having to change the osgi-exports...

Show different WYSIWYG options based on Role

It is easy to show different WYSIWYG options based on a users role.  All you need to do is to write a plugin that overrides the file:

/dotCMS/html/portlet/ext/contentlet/field/tiny...

Navigation Macro based on dotCMS' navTool viewtool

This macro extends the functionality provided by dotCMS' navTool viewtool.

It is based on folders and will allow you to set a starting point...

Pulling Related Host Specific Content excluding Global Content

This example allows you to pull related content on a specific host without including global content that is assigned to System Host.

When using...

Displaying Hints on Form Fields

If you want to display a hint for each of your Form fields you can do so by using the following Javascript snipet.

This example uses the Form's...

Comparing Dates in Velocity

This code sample will help you learn different ways to obtain today's date and format it. It also shows how you can compare two dates, or one content...

Displaying Metadata values from a File Content Type

When a new file is uploaded dotCMS extracts its metadata and indexes it for searches or to be displayed.

This sample shows how to take a list...

Creating, accessing and deleting Cookies using Velocity CookieTool

Velocity provides a viewtool to create, access and delete cookies. The tool is called: CookieTool and can be used on a widget by calling: org.apache...

Using AND and OR to pull content by Categories

When pulling content by categories sometimes you need to match categories using an AND, or an OR or sometimes a combination of both.

The example...

Pulling Content using RESTful ContentAPI

This example shows how to pull content from an external dotCMS site using the ContentAPI and displays the results paginated.

Using the Widget API

Since dotCMS 2.1 we provide an API to render a Widget based on its identifier.

This example shows how to use the api to pull a Widget from another...

Password Custom Field

The following code can be used to add a Password field to a content structure, including a Form.

Take the following steps to add a Password /...

Adding Categories to Content when Calling Checkin

The code below can be used to add a category by key to a contentlet when calling the checkin method.

Creating a List of Maps and adding to Session

This codeshare shows how to create a List of Maps of Strings, and to "set" and "get" the List on an attribute in the HTTP Session.

Parsing a JSON String using Jquery and Velocity

If you have a field on a content type that stores a JSON string, you can parse the string using a combination of Velocity and JQuery.

JQuery ...

Script to Remotely Deploy OSGI jar

This is a bash script that will allow you to remotely deploy an OSGi plugin via the command line.  This is helpful when developing remotely

Insert 500 Contents for Testing

This .jsp script will insert 500 pieces of content, which is a valid test for system performance.