[NBP web-reskin] [SCM] UNNAMED PROJECT branch, master, updated. 5f2b8805417bba5f42f12eaac6587b161413f257

Ethan Rowe ethan at endpoint.com
Mon Aug 10 12:42:34 EDT 2009


ethan at nbp.org wrote:
[snip]
> - Log -----------------------------------------------------------------
> commit 5f2b8805417bba5f42f12eaac6587b161413f257
> Author: Ethan Rowe <ethan at endpoint.com>
> Date:   Mon Aug 10 12:32:33 2009 -0400
> 
>     Clean up voices-of-our-readers to use the new [template] tag.
>     
>     Note that the header/footer stuff is all stripped from these, and
>     instead they simply use [template header] and [template footer].
>     
>     Along the way I cleaned up some quotation marks that probably came
>     from Windows-1252 or Latin-1, but don't play nice with the ASCII
>     encoding of this site.
[snip]

All,

I just pushed out a very modest templating improvement to the reskin
project, which should serve to benefit things for the time being.  I had
hoped to do a more significant change to the templating design, but upon
getting in there I felt a little uneasy about it.

This change will at least make things a little more concise.  If you
pull in the latest changes (reskin camps only), take a look at how
templating is done in the "Voices of Our Readers" pages (available under
the "Ways to Help" and "About Us" sections, corresponding in the
filesystem to "support" and "company" under the catalogs/nbp/pages/
directory).

Basically, at the top of the page, you simply want:
[seti x_page_title]...[/seti] (optional setting of page title)
[template header]

Then at the bottom:
[template footer]

The [template] usertag wraps a new Perl module that looks at the page
file's location on the filesystem, determines from that location what
section of the site it's in, and chooses the correct template variable
(for header and footer) from that information.

So, if the file is (relative to catalogs/nbp/pages/)
"/production/index.html", [template] identifies the section as
"production", which corresponds to the following header and footer
(respectively):
PRODUCTION_TEMPLATE_TOP
PRODUCTION_TEMPLATE_BOTTOM

This should work for all existing categories as they are currently
implemented.

If we want to change the templating more dramatically than this, we
certainly can.  But this is a reasonable first step; as we work through
the pages, we can adjust all of them to invoke their templates this way,
and it makes each page that much simpler.  And ultimately it gets all
the template inclusion logic encapsulated within the [template] tag and
the module it wraps, meaning we can make sweeping changes more easily later.

If on a given page you want templating that differs from the templating
used in that page's section of the site, you can override the template
variable names to use in a couple ways:

1. by prefix; specify a prefix and it will change both header and footer:
[tmp template_prefix]I_YAM_COOL[/tmp]
means [template header] includes I_YAM_COOL_TEMPLATE_TOP
and [template footer] includes I_YAM_COOL_TEMPLATE_BOTTOM

2. by header/footer:
[tmp template_header]MY_HEADER[/tmp]
means [template header] uses MY_HEADER
while [tmp template_footer]MY_FOOTER[/tmp]
means [template footer] uses MY_FOOTER.

Crude, but better than what preceded it.  Thanks.
- Ethan

-- 
Ethan Rowe
End Point Corporation
ethan at endpoint.com


More information about the Web-reskin mailing list