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

Recent Submissions

Custom Field - Hiding a Tab based on host

Author: dotCMS |

This code is an example of how you can get the host id that a content editor is on, and based on that host ID it will show or hide a tab in the content...

Multi-select custom field

Author: Brad Rice |

This builds on the codeshare Stephen Bell provided for using a custom field with a select. This uses a multi-select and reads back in multiple values and...

Pull a dropdown list (select) of other content into a custom field

Author: Stephen Bell |

Use this code in a custom field, to pull a list of other content into a select field. This code uses the jQuery Javascript library in a way that shouldn't...

Listing Request Attributes

Author: Maru Ahues Bouza |

The following code can be used on your site to list all the attributes and values stored in the Request object. Wrapped with a condition to only display...

Display Related Content Listed by Categories in a Multilingual Environment

Author: Alex Solorzano |

Sometimes you want to display related content listed and classified by category in a multilingual environment.

FileAsset Creation using the ContentletAPI

This is a very straightforward demonstration JSP that will transactionally checking a FileAsset content using the 2.2 starter site content schema.

Pull Nested Child Categories by Parent Category Key

Author: Dean Gonzalez |

Use this example to create dynamic parent/child category listings. The category listings can then become clickable listings to filter content by category...

Internal Navigation link fix-option

Author: Ati Rosselet |

Replacement for NavigationWebAPI.java in 2.2 branch (works for 2.5 too). Handles problem (if its a problem for you) where internal links are not relative...

Dynamic File Cachebuster Variables

Author: Michael Fienen |

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

How to Copy a Contentlet using Velocity

Author: David Higginbotham |

This example shows how to use the ContentletAPI to find a Contentlet by a given inode and then copy it.