Chad wrote:
> Just curious of how other pylons developers are doing site layout in
> their apps? Are you guys mostly using the template and includes?
>
> I'm currently using genshi and xi:include. This method works.. but it
> really seems like a lot of wasted code. In the past I've used several
> methods for site layout. Once we wrote a "filter" that automatically
> added a layout based on a url config file. We based this method off of
> sitemesh (http://www.opensymphony.com/sitemesh/). Rails allows you to
> automatically associate a layout with templates in a controller or all
> templates.
>
> Just curious about what other people are doing and what you think of
> rails/sitemesh..
I think sitemesh is awesome. It keeps out of your way yet is so flexible.
Don't know about genshi, but in mako I do the following:
I render the following template for every request which contains the
following code. It is passed two variables (the layout template, the
actual page template). This allows me to change layouts on each request
(if necessary just like sitemesh).
== apptemplate.mak
<%
if c.layout_template:
layout_template = self.get_namespace(c.layout_template)
else:
layout_template = None
namespace = self.get_namespace(temp)
body = capture(namespace.body)
if hasattr(namespace, 'head'):
head = capture(namespace.head)
else:
head = None
%>
%if layout_template:
${layout_template.layout(body, head=head)}
%else:
${body}
%endif
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---