Changing tabs

How to change the tabs (Home, News, etc) at the top of your Plone portal.

In this section we explain how to:

  1. Not show the tabs put there by default in the out-of-the-box Plone
  2. Make a new tab
  3. Change tab order
  4. Make tabs only appear after login or for certain roles

0) Automatically generated tabs

As of Plone 2.1, the tabs on the top will automatically be generated based on the folders that exist in the root of your Plone site. (The exception is the Home tab, which still resides in portal_actions)

You can rename, re-order and create new tabs by going to the root of your Plone site and clicking the contents tab.

If you want to turn this behaviour off, you can go to Site setup, Navigation settings, and untick the box Automatically generate tabs.

Since Plone 2.0, and still in Plone 2.1, you can also manage tabs manually using the portal_actions tool in the ZMI:

1) - Making tabs not appear

Say you want to get rid of the "Home" tab from the top of the portal.

Go to the Zope Management Interface (ZMI) in Plone Setup, and then to the portal_actions tool.

In this list, there are lots of different items, look for the things you want to not show (the tabs at the top have category portal_tabs). Untick the Visible checkbox on the items you do not want to appear in the portal.

2) - Making a new tab

First, create a folder in root of your Plone site from the Plone interface (not the ZMI). This is the new folder your new tab will link to. Make a note of the Short Name you give it, you will need this for the tab definition later.

Then, go to the ZMI and into the portal_actions tool (as in the first part of this how-to). Scroll down to the bottom of the page and you will see a form to add a new action.

Here you do the following:

  1. Enter the Short Name you made a note of earlier in the Id field. The reason these have to be the same is to get selection highlighting of the tab to work correctly.
  2. Type the name you wish to appear in the tab itself into the Name field.
  3. Type string:$portal_url/my-short-name into the URL (Expression) field. Replace my-short-name being the Short Name of the folder you created earlier and made a note of. Make sure there are no spaces in what you just typed.
  4. Leave the Condition field empty.
  5. Select View from the Permission field drop down menu. (Quick way to do this - since there are so many entries - is to select the pulldown, and press the V key on your keyboard.)
  6. Type "portal_tabs" into the Category field.
  7. Tick the Visible? box.
  8. Click add at the bottom of the form.

3) - Changing tab order

To change the order in which the tabs appear on the page, change their order in the ZMI by moving them above or below each other.

Go to the ZMI and then to the portal_actions tool, as explained earlier. Then select the box to the left of the item you want to move and then click on Move down or Move up buttons, next to the Save and Delete buttons near the bottom of the list of items.

4) - Making tabs selectively appear

  • To make tabs only appear after login (not for anonymous users), put python: member in the condition field of an action.
  • To make tabs only appear for a certain role (in this case, Managers), put the following in the condition field:
        python:portal.portal_membership.getAuthenticatedMember().has_role('Manager')
    

Condition field details

Posted by Marc Mengel at Dec 14, 2004 03:12 PM
While the Condition field is a TAL expression; the variables defined in the context of the TAL expression are different than when you're in a Page Template context (i.e. "here", etc. are not
defined...). This confused me greatly untill I Read The Fine Source.

According to the source, the list is:

object_url -- url of the current object/page

folder_url -- url of the containing folder

portal_url -- url of the site

object -- the current object

folder -- the current folder

portal -- the site Plone instance

nothing -- python: None

request -- the current REQUEST object

modules -- the current importer module

member -- the current user

So you can put in conditions like:

python:object_url.find("/blah")>0

to make a tab appear only in the "blah" folders...

not all that outdated

Posted by John DeStefano at Jan 09, 2008 05:09 PM
Marked "outdated", but still seems relative to v3.0.x. The only discrepancy I see is in part 2, step 8: "Click add at the bottom of the form". I believe this should now be "Click 'Save Changes' ...", since the 'Add' button relates to adding a new property to an existing action, not to saving changes to the new action.

I take that back...

Posted by John DeStefano at Jan 09, 2008 05:14 PM
To update part 2:

In the ZMI, navigate to /[yoursite]/portal_actions/portal_tabs

Next to the CMF Action pull-down, click Add.

Enter a new value in the ID field ("myfolder"), and click Add.

In the portal_tabs list, click the name of your new portal tab ("myfolder").

 ... continue as above, and then click Save Changes.

Home Tab

Posted by David Godin at Jan 27, 2008 12:27 AM
How would you make the default Home tab actually point, or be the News folder? Says my site's first page must be the News...

Thankx

home tab

Posted by Amisha Babla at Aug 21, 2008 02:01 PM
go to:
home
contents
display
select a content item as default view...

and then select your News folder
I'm using version 2.5.3, don't know if it's the same in the others.

Does anyone know how to actually rename the Home tab? (I want it to say welcome :) )

How can we set a portal tab to redirect to different pages depending on language selection ?

Posted by Cuneyt Gargin at Aug 28, 2008 01:39 PM
I can change and add portal tabs. I can translate its name by changing i18n files. However, when my site runs in 2 different languages. One portal action can only go to one page, however, it should either be one language or another language, i.e. lets assume i have documents page, and i put a portal action and it shows a page called documents. Lets assume also i have a german version and portal tab has Dokumente page, which is German. But in any language, when i click on portal tab Documents(English) or Dokumente (German), it can only go to one page which is given in Portal actions.


How can we set a portal tab to redirect to different pages depending on language selection ?