Recent Submissions

Blog Detail Page with URL mapping, inline editing, captcha, commenting, and RSS

Blog Detail Page with URL mapping, inline editing, captcha validation, moderated commenting, and an RSS feed (RSS page code included in another code...

Blog Title Search, Category Menu and Blog Tag Cloud

This code example shows you how to create the blog title search, blog category menu, and blog tag cloud shown in the right hand column of the image ...

Content Driven Menus

Not recommending this as a best practice or anything because there are a lot of inherent dangers on allowing your menu navigation to be changed by a...

Import Content (ContentletAPI Example)

From Chris Falzone - an example of importing content in dotCMS (1.7) using the ContentletAPI

Deleting a User from the Database

This SQL will delete/repoint references to a user.  This SQL needs to be run in the DB and once complete, you will need to flush the cache for ...

Checkin Content from HashMap - Transactional

This is a very straightforward demonstration JSP that will transactionally checkin 10 pieces of "News" content using the 2.1 starter site content schema...

Generate A Random Number with Limits

This simple snippet generates a random number between 1 and 5

Sample Blog Listing With URL Map, Pagination, Tag&Cat Search

Sample Blog Listing With URL Mapping for more friendly URL building, pulling a paginated listing using the new dotContent tool, and Tag and Category...

Dynamic Content Anchors

This snippet creates Anchor Tags and a navigation links for each contentlet in a container.  The idea being that as content is added to the container...

Disable Crawler Traffic

The following snippet is a urlRewrite rule to disable traffic from a crawler.  Just replace crawleragent with the User Agent of the crawler. The...

Display a list of Items in a folder

This snippet shows how to the use the macro viewtool's fileRepository method to build a list of files and folders in a folder.  This is the same...

Looping over the values of a Key Value field

It can be hard to understand what is in a key value field.  The below code will loop over the values and spit out the keys and the values.

Pull Latest Vimeo Video

This code will pull the description, image and title of your latest Vimeo video and put it into your page. Vimeo feeds are more well-formatted than ...

Strip HTML tags from WYSIWYG Field Output

Very simple method for cases where you need to get rid of the HTML tags in a contentlet field, like auto-generating a content summary when a manual ...

Load Latest Tweet (Twitter) into Page

This code will pull in the latest tweet from any Twitter account and display it in your page. It also does the work of converting addresses, hash tags...

Minimal Starter Site

In the event that you want to install dotCMS with the minimal amount of content necessary (i.e. you don't need or want the default starter site), you...

Display Link/Description of Latest YouTube Video

This code displays the latest YouTube video posted to any account. Because the YouTube RSS feed makes extensive use of tables and inline styles, we ...

URLMapContent Failsafe

Include this code at the top of your template or in your init container so that in cases where a detail page is being hit outside of a URL Map Pattern...

Set Cookies Via Header Requests

In cases where you have a known condition that you want to save as a cookie to the user's browser (Have they been here before? What was the last page...

Display Facebook Page RSS Feed

Use this code to pull an RSS feed from Facebook for your institution's Page, and display the most recent item in your HTML code.

This feed only...