[Nitro] replacement transformer

Bryan Soto bryan.a.soto at gmail.com
Tue Apr 11 15:00:40 EDT 2006

On 4/11/06, Dimitri Aivaliotis <aglarond at gmail.com> wrote:
> Does anyone know how to do something like this with the current
> (repo-version) Nitro?

About the best I can think of would be to define the fragments you
want to render, i.e @content = :mylink, in your controller, then in
your view <render href="#{@content}" />, where :mylink would be stored
in a file, mylink.xhtml. The class for the href could be handled
similarly, i.e. @a_class = 'current', then in the view, <a
href="/mylink" class="@a_class">link</a>.

Or perhaps as elements? I wonder if <#{@element} /> works?

I'm assuming you knew that though and that wasn't what you were looking for. :)

> I just wanted to check before I go re-inventing the wheel.  I know
> that this type of behavior has been requested by others, I just don't
> recall if it's been implemented yet.

I guess you're basically looking for a way to pre-process templates
with the controller actions before they go through normal processing.
I don't think there's anything like that currently. Rather fine
grained control too going by your code fragment.

*sigh* Now you've got me intrigued and I've got glue files to move. :)

I don't know how badly you need this, but perhaps rendering via
instance variables would work for now if it's a prototype? I suspect
plugging in a template transformer the way you specified would be a
bit harder to do...


"Never tell people how to do things. Tell them what to do and they
will surprise you with their ingenuity." —General George S. Patton

More information about the Nitro-general mailing list