If you should do some more advanced layout/styling of your portlet output code that might need to be altered later on, a viable solution is to use named CSS classes in your code and define these in a CSS that SiteVision can deliver to visitors. By doing that, the style of your portlet can be altered/modified externally without any need for re-compilation/re-deployment. The disadvantage is that your portlet has a dependency to an external CSS code.
NOTE! To avoid naming collisions - be sure to use unique names for your CSS classes!
To achieve some uniqueness you can prefix or suffix your class names with the name of your organization and/or portlet name. E.g. the class names 'xyz-myportlet-normal' and 'xyz-myportlet-redbox' are preferred to 'nomal' and 'redbox'.
Below is an example of output code of a portlet that needs to be re-compiled/re-deployed if the border color later on needs to be altered (BAD):
<div style="border:1px solid red">
<p class="portlet-font">xx xx xxxx xxx xxxx xxx</p>
CSS classes can be incorporated in the SiteVision output code in two ways:
It's up to you to decide which way to go.
You don't necessarily need to hard-wire the css, you can make the css configurable by an administrator in two different ways.
(Though, in real life this might not be an viable option if the output of your portlet contains lots of css.)
You can put your "might want to change this css sometime in the future"-setting(-s) in the portlet xml so an admin can change it without re-compilation (i.e. doesn't need access to the source code). The portlet.xml file is plain xml so most admins should manage to do an update. The SiteVision service must be restarted for the new settings to used.
You can use the SiteVision custom portlet mode to expose your "might want to change this css sometime in the future"-setting(-s). Then an admin can enter the SiteVision editing mode ("offline mode"), double-click your portlet and simply edit the value. The new settings will be used when the page is published.
The page published: 2013-09-17