Grok has full built in support for re-skinning a site.  A skin may be as simple as using a different CSS, but at the other end of the scale may be used to completely replace site content.  Reality lies somewhere between these extremes.

Skins are typically used when you want to present a slightly different view on your site.  Generally, the url for a view containing a skin, would be something like:

http://address:port/++skin++skin_name/[rest of url]

If you are reading this on your own installation of the Grok 4 Noobs distribution, you can try accessing a skinned version of your site by inserting the /++skin++bootstrap/ skin name just after the localhost:8080. eg.

http://localhost:8080/++skin++bootstrap/gfn/Extending+GFN/Layers+and+Skins/

If you are accessing it via the aptrackers.com host, try instead:

http://gfn.aptrackers.com/gfn-bs/Extending+GFN/Layers+and+Skins/

If you do nothing in particular about skins, Grok will create a default one for you with a blank name.  So a Grok app will actually always use a skin, even if it may not be evident.

The way you specify in code that your view is to use a particular skin, is to associate the view with a layer, and to in turn associate the layer with a skin.  Like this:

class LayerClass(grok.IDefaultBrowserLayer):
    grok.skin('skin_name')

class MyView(grok.View):
    grok.layer(LayerClass)
    ...

Note that the LayerClass is actually an Interface, since it subclasses the IDefaultBrowserLayer interface.  Since the default layer for Grok views is an IDefaultBrowserLayer, the new skin inherits all of the views which already use the default.  So the new layer extends the set of components already registered for the default, but any views that explicitly state the new layer will not be available to the default layer.

 

Grok 4 Noobs

Using Layers and Skins: How to re-skin your Grok site