Self-contained member folders

January 2, 2005 at 6:00 pm

I wanted to make it possible for artists to create a portfolio in a
Plone site and have that same portfolio become their actual website.
This requires tweaking a few aspects of how Plone works:

  • Domain name
  • Skin
  • Navigation (navtree and breadcrumb trail)
  • Search
  • Portlets

Domain name

Using the Virtual Host Monster, I created a mapping for the user winnie:

winnie.domain.com -> /ac/Members/winnie/portfolio/
(“ac” is the ID of my Plone site)

Now when I go to winnie.domain.com, it redirects me to Winnie’s portfolio page.

Skin

Since each artist would like to have his/her own logo, colors and other
branding, we can use an access rule to change the skin depending on
whether the user is viewing the artist’s folder using the specific
domain name, or whether they are browsing to the site via the portal
site.

Set skin:

winnie.domain.com -> change to the skin_winnie
www.domain.com/Members/winnie/portfolio -> use the default site skin

So that I don’t have to create an access rule for each and every
member, I place one script in the Members folder and set it to the
access rule:


What this does is get the subdomain from the REQUEST
environment variable BASE0 (could also use SERVER_URL here), and then
if it is equal to “www” (meaning we are just browsing to the artist’s
folder), then keep the normal site skin. But if the subdomain is
anything other than “www” (i.e. “winnie”), then we change the skin. We are assuming
that the skin is named the same as the subdomain with “skin_” prepended.

Navigation

The problem with using VHM to send the user to a specific artist
folder in the Plone site, is that the navigation tree and breadcrumb
trail still show the parent
folders. We want to give the impression that you are not in a portal
site, but viewing an individual artist’s site, so we need to “hide”
these unnecessary navigational elements.

Breadcrumb trail

We will just eliminate the breadcrumb trail since it’s not
really necessary for a small artist site. In portal_skins/skin_winnie/ploneCustom.css we change
the visibility property of portal-breadcrumbs:

Navigation Tree

And to make sure that the left navtree shows only the folders for Winnie’s portfolio page, we need to add a topLevel property to the Members folder.
In the ZMI, go to Members -> Properties

Add new property:
name: topLevel
type: int
value: 4

TODO:

  1. make an ‘Up one level’ or ‘Home’ link at the top of the navtree,
    so that the user can get back to the frontpage. Or find out how to do
    this in the navtree_properties. Preferably we shouldn’t have to edit
    the portlet_navigation.
  2. look at PloneSolutions’ TreeNavPortlet which is a much better implementation of the navtree. Wait until it’s separated from the PlonePortlet product.

Search

When a user is viewing the artist’s portfolio page using the specific
domain name (i.e. winnie.jazkarta.com) we want the search box to only
search the individual artist folder, not the whole site. The search box
should search the whole site if we browse to the artist’s folder via
the portal site. As in the following:

Search box displayed on page:

winnie.domain.com -> limit the search to the path /ac/Members/winnie/portfolio
www.domain.com/Members/winnie/portfolio -> do not limit the search path.

I’ve explained how to do this at the bottom of this howto on the Plone.org website.

Portlets

We don’t want to display all the sitewide portlets when viewing an
artist’s folder, so we probably need to override them by modifying the
left_slots and right_slots properties for the Members folder, and then
add some tal:condition statements to check to see how the user is
accessing the artist folder.

Show portlets:

winnie.domain.com -> don’t show the sitewide portlets since the artist wants the user to stay on their page
(but maybe show one called “Related artists” or something like that)
www.domain.com/Members/winnie/portfolio -> use the sitewide portlets to encourage users to visit other areas of the site