OpenCms "Tips and tricks"!

In this page we will see some "Tips and Tricks". We hope they will be useful for you!

HTML edtor

HTML edtor

  •  05 July 2016

OpenCms uses the “HtmlWidget” widget to manage contents in HTML. The HTML editor is based on TinyMCE plugin.

In case you use the <i> tag, this tag will be replaced automatically by <em> tag, while the <b> tag will be replaced by <strong> tag.

For <i> tag this behaviour is annoying because the <i> tag is used in Bootstrap to display icons.

However you can use a workaround by modifying the “resources/editors/tinymce/jscripts/tinymce/tinymce.min.js” file; this is a file created on real file system when OpenCms is installed: you have to find the em/i string and delete it.

I know that the trick is a bit dirty (the best solution could be to generate a new custom module), but it's effective.

  •  Tested on OpenCms 9.5.2

How to render fonts having special extensions

How to render fonts having special extensions

  •  16 June 2016

If you have to manage fonts having special extensions (for example ttf, eot, woff), you can see that all runs right in offline project, but they are not rendered correctly in online project. To render them correctly you have to modify OpenCms configuration files.

The first step is to modify opencms-vfs.xml, to add the mimetype needed, for example font-woff:

<mimetypes>
      <mimetype extension=".ez" type="application/andrew-inset" />
       ...

<!-- New mimetype -->

<mimetype type="application/font-woff" extension=".woff"/>

<!-- end New mimetype -->

</mimetypes>

 The secon file you have to modify is opencms-importexport.xml, as in the following example:

<defaultsuffixes>

<suffix key=".jpg" />

...

<!-- New suffix -->

<suffix key=".woff"/>

<!-- end New suffix -->

</defaultsuffixes>

In order to the new configuration works you have to restart your application server (usually Tomcat).