Creating a static-text portlet
This How-to applies to:
Any version.
This How-to is intended for:
Integrators, Customizers
To create a portlet containing static text, save the following code in a page template called portlet_static in the Custom folder of your portal_skins.
Code:
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
i18n:domain="plone">
<body>
<!-- The static box -->
<div metal:define-macro="portlet">
<div class="portlet" id="portlet-static">
<h5 i18n:translate="box_statis">Your Title</h5>
<div class="portletBody">
<div class="portletContent odd">
Your static content here
</div>
<div class="portletContent even">
More static content here
</div>
</div>
</div>
</div>
</body>
</html>
You can call this from a right or left slot with here/portlet_static/macros/portlet.
You are right
you should remove word: "portlet" after here/...
here/portlet_static/macros/portlet
you should right:
here/static/macros/portlet
it is not a finished portlet from Zope and plone can not find it in portlet files
have fun,
:)
Still can't get it to work
then added the line
here/static/macros/portlet
I still gives an exception. attribute error
pliz help...
What version??
To which slot have you added it?
Width problem
Can this width be forced, to display constantly in all browsers?
Change in plone 2.1.x and onwards
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
i18n:domain="plone">
<body>
<!-- The static box -->
<div metal:define-macro="portlet" tal:omit-tag="">
<dl class="portlet" id="portlet-static">
<dt class="portletHeader">Title</dt>
<dd class="portletItemSingle odd">Some content</dd>
<dd class="portletItemSingle even">Some content</dd>
<dd class="portletItemSingle odd lastItem">Last item</dd>
</dl>
</div>
</body>
</html>
Don't forget the lastItem tag (even if it is the only and first row), otherwise you will get a double border at the end of the portlet (and possibly other issues)...
Have fun and a happy migration to plone 2.5!
plone 2.5
<!-- The static box -->
<div metal:define-macro="portlet" tal:omit-tag="">
<dl class="portlet" id="portlet-static">
<dt class="portletHeader">Title</dt>
<dd class="portletItem odd">Some content</dd>
<dd class="portletItem even">Some content</dd>
<dd class="portletItem odd">Last item</dd>
</dl>
</div>
this doesn't work
I signed up for my first plone site with zettai.net and I tried this tutorial ... here's what I got:
Site Error An error was encountered while publishing this resource.
AttributeError
Sorry, a site error occurred.
Traceback (innermost last):
Module ZPublisher.Publish, line 175, in publish_module_standard Module Products.PlacelessTranslationService.PatchStringIO, line 51, in new_publish Module ZPublisher.Publish, line 132, in publish Module Zope.App.startup, line 204, in zpublisher_exception_hook Module ZPublisher.Publish, line 101, in publish Module ZPublisher.mapply, line 88, in mapply Module ZPublisher.Publish, line 39, in call_object Module Products.CMFCore.PortalContent, line 116, in __call__ Module Shared.DC.Scripts.Bindings, line 306, in __call__ Module Shared.DC.Scripts.Bindings, line 343, in _bindAndExec Module Products.CMFCore.FSPageTemplate, line 191, in _exec Module Products.CMFCore.FSPageTemplate, line 124, in pt_render Module Products.PageTemplates.PageTemplate, line 96, in pt_render