How to customize a SmartPortlet portlet
This How-to applies to: Any version.
Structural Changes
If you want one of your SmartPortlets to be structured differently from the others:
- Go to portal_skins/SmartPortlets in the ZMI
- Click on the "smartportlet" template.
- Click the "Customize" button on the template page.
- Before you make any changes, rename the template (ie, give it a new id, like "my_smartportlettemplate". If you want your changes to apply globally to all SmartPortlets, there's no need to rename the template.
- Make whatever changes you need, then save the template.
- Plug your custom SmartPortlet into left_slots or right_slots with an expression like
here/smartportlets_tool/my_smartportlet/my_smartportlettemplate.
Style Changes
Each SmartPortlet portlet is wrapped in a DL tag that has an ID attribute based on the ID of the SmartPortlet object from which it is derived. For example, if you have a SmartPortlet object with an ID of "foo", then the DL wrapping the generated portlet will have an ID attribute of "smartportlet-foo".
You can use that ID attribute as a CSS selector to style that DL and everything contained within it. For example, if for some reason you wanted the portlet title to have a red background:
dl#smartportlet-foo dt.portletHeader {
background-color: #F00;
}
That's it!