Quantcast
Channel: Planet Plone - Where Developers And Integrators Write
Viewing all articles
Browse latest Browse all 3535

UW Oshkosh How-To's: How to hide the title and/or description on a Plone 4 page

$
0
0

Based on information at http://plone.org/documentation/kb/how-to-write-templates-for-plone-4

Create the view template

If you want to hide the title and description on a Plone page, you can create a new template that does that.

  • Go to the ZMI -> portal_skins
  • Use the Find tab to look for an object with the ID "document_view". Click on it, then click on the Customize button.  
  • In the breadcrumbs, click on the "custom" link to take you up one level.
  • Check the box next to the document_view object, then click the Rename button at the bottom of the page.  Give it a new name (e.g. document_no_title_or_description_view) then click the OK button.
  • Click on the document_no_title_or_description_view object again to edit it, and replace its contents with the code below.

 

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
      xmlns:tal="http://xml.zope.org/namespaces/tal"
      xmlns:metal="http://xml.zope.org/namespaces/metal"
      xmlns:i18n="http://xml.zope.org/namespaces/i18n"
      lang="en"
      metal:use-macro="context/main_template/macros/master"
      i18n:domain="plone">
<body>

<metal:content-title fill-slot="content-title">
    <metal:content-title define-macro="content-title">
     </metal:content-title>
</metal:content-title>

<metal:content-description fill-slot="content-description">
    <metal:content-description define-macro="content-description">
     </metal:content-description>
</metal:content-description>

<metal:content-core fill-slot="content-core">
    <metal:content-core define-macro="content-core">
        <metal:field use-macro="python:context.widget('text', mode='view')">
            Body text
        </metal:field>
    </metal:content-core>
</metal:content-core>

</body>
</html>

The difference between the above and the default view template is that both the content-title and the content-description macros no longer do anything.

Next, you have to enable this new customized view template for pages ("Documents").

Add the new view template to the page/Document type

  • Go to ZMI -> portal_types -> Document
  • Add one more line to the "Available View Methods" field, containing document_no_title_or_description_view, and press the Save Changes button.

 

Using the new view template

  • Go to the page on which you wanted to hide the title and description.  
  • The Display drop down menu should now include a new choice "document_no_title_or_description_view".  Select it, and the page should now no longer show its title nor its description.

 


Viewing all articles
Browse latest Browse all 3535

Trending Articles