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

Recent Submissions

Show different WYSIWYG options based on Role

Author: dotCMS |

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:

Getting all the content objects on a page

We have been asked repeatedly how to get a list of all the content objects that have been placed on a page by a content editor.

Create a "Parse VTL" Widget Structure

Author: Dean Gonzalez |

This example allows you to execute the code in vtl files by simply browsing for them and saving a piece of widget content.

Convert Velocity request parameters to JSON

Author: Nathan I. Keiter |

Update to my previous submission. I added an if block so it does not break if there are no request parameters.

Script to Remotely Deploy OSGI jar

Author: dotcms |

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

form add new feature

Author: shimanan |

## incoming form structure one of fieldName contain word email, will send message, default false;

custom field couple with program

Author: shimanan |

This code will pull a list of content into a custom field and create a select box for each result.

Image gallery that works with file assets and documents

Author: Kivi Shapiro |

The default version of image-gallery.vtl that comes with dotCMS only works with image files of type Document.

Handling XML Feeds with Children and Namespaces

Author: Dean Gonzalez |

The code below is a quick example on how to handle nested children in a simple XML feed and how to handle namespace fields that have a : in them.

Date Looping

Author: Christopher Falzone |

This is how you can loop over a range of dates in velocity