Codeshare List of user-contributed code snippets for dotCMS Java CMS.

Author: "Michael Fienen"

Dynamic File Cachebuster Variables

Author: Michael Fienen | Created: Nov 16, 2012

There are times where you might want to add a dynamic variable to the end of a file to help browsers repull the file after changes have been made to it...

Conditionalized Structure Fields

Author: Michael Fienen | Created: Oct 25, 2012

This javascript code can be used in a custom field as an example of making fields visible conditionally based on the value of another field.

Getting the page context values

Author: Michael Fienen | Created: Oct 18, 2012

This will echo out all the Velocity variables set in the given page's context.

Flexible Navigation Macro

Author: Michael Fienen | Created: Jul 11, 2012

This macro is designed to wrap the stock navigation() macro such that it will default to the current location depth, with a default depth, both of which...

Phone Number Formatting Macro

Author: Michael Fienen | Created: Apr 20, 2012

If you have ever had multiple people entering phone numbers into a field, you have no doubt discovered the varied formats they can provide.

Lucene Syntax to Respect Publish and Expire Dates

Author: Michael Fienen | Created: Mar 14, 2012

If you are trying to do something, for instance with news items, that need to respect both a publish and expire date, you just need some simple Lucene ...

URLMapContent Failsafe

Author: Michael Fienen | Created: Jan 19, 2012

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,...

Minimal Starter Site

Author: Michael Fienen | Created: Jan 19, 2012

In the event that you want to install dotCMS with the minimal amount of content necessary you can download this starter.zip file and replace the one included...

Strip HTML tags from WYSIWYG Field Output

Author: Michael Fienen | Created: Jan 19, 2012

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 summary...

Set Cookies Via Header Requests

Author: Michael Fienen | Created: Jan 19, 2012

In cases where you have a known condition that you want to save as a cookie to the users browser, have they been here before , what was the last page they...

Topics

Have you created code you'd like to share with the dotCMS community?

Share your code Become a Contributor