[Grok-dev] Re: Skinning/themeing
Martin Aspeli
optilude at gmx.net
Fri May 18 18:47:45 EDT 2007
Lennart Regebro wrote:
> On 5/18/07, Martin Aspeli <optilude at gmx.net> wrote:
>> I assume we are still considering viewlets as the way of making
>> "pluggable" UIs, i.e. aspects of a page where you can plug in new
>> elements without modifying the view, and where you can vary the thing
>> being plugged in by context type.
>
> Viewlets, sure.
>
>> The match approach described in the email above, as I understand it, is
>> about defining a pipeline which post-processes the "bits" of a page
>> (which is of course useful for all kinds of things). It works the
>> opposite way to Deliverance, in that you start with a "composed" set of
>> markup and then selectively swap out bits of it.
>
> I understand it like deliverance.
Okay, let me try to invent some examples.
Deliverance-like branding
-------------------------
o Designer makes a static HTML page in Dreamweaver, called theme.html
o Designer puts a <div id="navigation" /> where the navigation box
needs to go and a <div id="content" /> where the content of the current
page needs to go
o Developer (who may of course be the same person in a different
context) writes a view for a content item. The view uses a
main_template-like thing to get some common site structure, including
contextual navigation (perhaps from a viewlet). The navigation has
id="navbox" and the main output of the page has id="pagecontent"
o Designer configures theme.html to be applied on the content in the
pipeline, and writes a rules.xml file which says "in the rendered page,
take the contents of id="pagecontent" and put it inside the div with
id="content", and ditto for the nav box
Match-templates
----------------
At least as I understand them ...
o Developer (who may of course be the same person in a different
context) writes a view for a content item. The view uses a
main_template-like thing to get some common site structure, including
contextual navigation (perhaps from a viewlet). The navigation has
id="navbox" and the main output of the page has id="pagecontent"
o Designer wants the title to be a big fat box, writes in Python:
class TitleBoxMatcher(grok.MatchView):
grok.skin('some_skin')
grok.match('/div[@id=titlebox]')
And in titleboxmatcher.pt:
<div id="title-with-logo-bg">
<div class="bigbox" tal:content="context/title" />
</div>
At least if my reading of this is correct, then you'd possibly need
several ones of these.
Martin
More information about the Grok-dev
mailing list