[Seaside] template substitution (was: Seaside Digest, Vol 30,
Issue 23)
Yanni Chiu
yanni at rogers.com
Mon Jun 20 06:03:07 CEST 2005
Avi Bryant wrote:
>
> html template name: 'listPage'; replace: #body with: [
> html list items: someCollection do:
> [:ea |
> html template
> name: 'listItem';
> replace: #name with: ea name;
> replace #description with: ea description]
> ]
>
> If this sounds interesting to people maybe I'll take the time to work
> more on it (or better yet, maybe someone else will take the idea and
> run with it...)
I used to have a templating framework that I was using
before I finally tried out Seaside, and then moved away
from templating. Just a few weeks ago, I dumped it from
my image - it never occurred to me that one might still
want templating, when using Seaside.
IIRC, it parsed a stream for %xxx%, and kept a
collection of offsets for each such spot. Then a
render call would be made with a dictionary supplying
the substitution strings. Somehow, a collection of
values would result in an iteration over a portion
of the file. Not surprisingly, building the data
for the rendering was a major headache.
I'll take a few moments to try and revive it, and fit
it into the suggested API. Another possibility is to
use the substitution parameter name as a getter method.
--yanni
More information about the Seaside
mailing list