On 4 May 2013 00:48, Mike Orr <[email protected]> wrote:
> Are there any good examples around of using Chameleon with a site template
> macro? I normally make my sites by inheriting from a Mako template that
> provides a standard <head> and header/footer, with the page template
> overriding the title, possibly adding stylesheet and Javascript links,
> supplying data for the breadcrumbs, etc. I know this can be done with
> Chameleon macros and slots and providing the site template in the template
> namespace, but does anyone have an example of it that I can borrow the
> syntax? Kotti does this but it also has a custom 'api' object in the
> template namespace, which I'm not sure if I want to follow.
Chameleon makes it pretty easy I'd say to use a site template:
<html metal:use-macro="load: ../master.pt">
<div metal:fill-slot="content">
<h1>${title}</h1>
...
</div>
</html>
You can also use ``metal:extend-macro`` to make a linear
specialization that keeps slots "fillable". For instance, you might
specialize your "master.pt" template into a "content.pt" template that
is then the basis of all content object views.
\malthe
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.