[Zope-CMF] Lost in SkinSpace!

Jon Edwards jon@pcgs.freeserve.co.uk
Fri, 28 Jun 2002 11:29:54 +0100


I'm trying to hack the Skins mechanism to allow different skins to be used
by different parts of the site, but I'm a bit lost in the source-code!

I've added a "skin_choice" variable to PortalFolders, so that the site-admin
can choose which skin should be used in that part (to allow
sites-within-sites). The logic I'm aiming for is something like -

    if the "portal_skin" variable is set in Request, use it;
    else, if the "skin_choice" variable is set locally, use it;
    else, use the defaultskin

After much code-diving, I think I need to do this in the SkinsContainer.py
getSkin method. Something like -

    def getSkin(self, request):
        '''
        Returns the requested skin.
        '''
        varname = self.getRequestVarname()
        name = request.get(varname, None)
*       if name is None:
*           name = context.skin_choice
        skinob = None
        if name is not None:
            skinob = self.getSkinByName(name)
        if skinob is None:
            skinob = self.getSkinByName(self.getDefaultSkin())
            if skinob is None:
                skinob = self.getSkinByPath('')
        return skinob

Am I on the right lines? Is this a reasonable way to achieve it?

TIA

Cheers, Jon