Best Practices

From OpenCms Wiki
Jump to: navigation, search
  • Try to re-use existing components (the TemplateOne system, downloadable modules) whereever possible. The temptation is to re-invent rather than to adopt existing components, which will often take significant time.
  • Leverage properties where possible, instead of using hard-coded values. Properties can be set at the root of a site and cascade downwards, allowing much more flexibility.
  • Use structured documents sparingly; make sure that any complex document type is thoroughly designed prior to loading your content. It can be very difficult to migrate from one XSD structure to another, more complex form.
  • Consider your template architecture carefully. A simple page skeleton that uses properties to dynamically load in references to style sheets, javascript, global navigation, and sidebars can be quite powerful.
  • Don't optimize too soon. OpenCMS has many ways to tune its performance once you get to launch. Don't write stupid code in your scriptlets, but don't kill yourself solving problems until you're sure you actually have them.
  • Wrap your links within <cms:link>link</cms:link> tags. If this is forgot renaming of the webapplication or static export or moving will not work.
  • Try to use JSTL code with Expression Language instead of scriptlet code. It's better to maintain. You have full Expression Language access to OpenCms via the <cms:contentaccess> - Tag.
Personal tools