Working with Skins in Plone
Thu, 01 Feb 2007 08:59:03 -0600
This one took me a minute to figure out, but I'm happy I did. To create a new skin from the filesystem, and add your own layers to it (or in this case, add the layers from Plone Default), do the following:
Pretty straight forward, right? In any case, it is helping me immensely with the current project.
#use this to get the skins directory
ps = getToolByName(self,'portal_skins')
# use this to add a new folder to that directory for your new skin
ps.manage_addFolder(skin_id, skin_id)
newSkinFolder = getattr(ps, skin_id)
path = newSkinFolder.absolute_url()
# get a set of tuples of all skins
paths = ps.getSkinPaths()
# these lines get the layers from Plone Default
defPath = paths[0]
defPath = defPath[1]
# add your new folder to the top of the Plone Default layers
defPath = skin_id "," defPath
# add the skin to the properties of portal_skins
ps.addSkinSelection(skin_id, defPath, 0, 0)
ps = getToolByName(self,'portal_skins')
# use this to add a new folder to that directory for your new skin
ps.manage_addFolder(skin_id, skin_id)
newSkinFolder = getattr(ps, skin_id)
path = newSkinFolder.absolute_url()
# get a set of tuples of all skins
paths = ps.getSkinPaths()
# these lines get the layers from Plone Default
defPath = paths[0]
defPath = defPath[1]
# add your new folder to the top of the Plone Default layers
defPath = skin_id "," defPath
# add the skin to the properties of portal_skins
ps.addSkinSelection(skin_id, defPath, 0, 0)
Pretty straight forward, right? In any case, it is helping me immensely with the current project.




