src/source/howto-portlet.rst
changeset 90 06915aa059c5
parent 83 ee94d17857a4
child 104 942151432421
equal deleted inserted replaced
67:81281f49aeb4 90:06915aa059c5
     1 .. _portlethowto:
     1 .. _portlethowto:
     2 
     2 
     3 
     3 
     4 How to create a new Portlet?
     4 How to create a Portlet?
     5 ============================
     5 ========================
     6 
     6 
     7 **Portlets** are pluggable user interface software components that are managed and displayed in a web portal,
     7 **Portlets** are pluggable user interface software components that are managed and displayed in a web portal,
     8 for example an enterprise portal or a web CMS. A portlet can aggregate (integrate) and personalize content from
     8 for example an enterprise portal or a web CMS. A portlet can aggregate (integrate) and personalize content from
     9 different sources within a web page. A portlet responds to requests from a web client and generates dynamic content
     9 different sources within a web page. A portlet responds to requests from a web client and generates dynamic content
    10 (*reference:* `Wiki portlet`_).
    10 (*reference:* `Wiki portlet`_).
   158 given portlet by given distinct names to the adapters:
   158 given portlet by given distinct names to the adapters:
   159 
   159 
   160 .. code-block:: python
   160 .. code-block:: python
   161 
   161 
   162     @adapter_config(name='another-renderer',
   162     @adapter_config(name='another-renderer',
   163                     context=(IPortalContext, IPyAMSLayer, Interface, INewPortletSettings), provides=IPortletRenderer)
   163                     context=(IPortalContext, IPyAMSLayer, Interface, INewPortletSettings),
       
   164                     provides=IPortletRenderer)
   164     @template_config(template='my-portlet-render-2.pt', layer=IPyAMSLayer)
   165     @template_config(template='my-portlet-render-2.pt', layer=IPyAMSLayer)
   165     class AnotherNewPortletRenderer(PortletRenderer):
   166     class AnotherNewPortletRenderer(PortletRenderer):
   166         """Another new portlet renderer"""
   167         """Another new portlet renderer"""
   167 
   168 
   168         label = _("Another comment renderer")
   169         label = _("Another comment renderer")
       
   170 
       
   171 .. tip::
       
   172     You can use an other template without create a new renderer component,
       
   173     with :py:func:`pyams_utils` to override the default template with you own.
       
   174 
       
   175 
       
   176 .. note::
       
   177 
       
   178     Select the new portlet in ZMI to make it available in the website template editor
       
   179 
       
   180     .. image:: _static/select_portlet.png