[Nitro] how to initialize @color and make it visible into the template?

Arne Brasseur arne at arnebrasseur.net
Mon Jul 9 15:53:50 EDT 2007

Jimmy Jazz schreef:
> but Nitro seems to ignore @color wherever you declare it (controller, 
> template, <?r ?>, %{}, etc.). Any advice ?
Just do like this in your template: <Box color="#e3f" />.

The thing with templates that confused me in the beginning also is that 
they are rendered only once, the first time a page is loaded. So if you 
evaluate code in an element the result should always be the same, or 
generate template code.

So if you want to access instance variables set in a controller, you 
need to generate code to do that, and not do it directly.

> I don't want to be careless. Nitro looks nice but it is finally far 
> more complicated to use as it looks like at first, mostly because 
> there aren't usable examples available to beginners. Please, don't 
> make it to elitist :( I'm really feeling i'm using the hard way, not 
> to mention nitro is using facets too.
> @George: It is like deciphering the Rosetta stone to understand 
> Egyptian hieroglyphs writing. Easy for one who can read Greek but 
> harder to the other ;)
Well I started out here crying for documentation, but G tought it better 
to prepare 0.50 first. I still plan to start the effort of a proper 
manual, but in the meantime I'm converting tests to specs because it has 
to be done before 0.50 can be released. Also I'm quite new to Nitro 
myself, still learning as I experiment and read the sources.

I feel your pain Jimmy, it's not easy for a newbie to get up to speed 
with Nitro quickly. I'm pretty sure this will change over time, but as 
it stands things move slow. G is very busy with other stuff, and this 
also forms a bottleneck. Several questions can only adequately be 
answered by him.

But if anyone wants to contribute... most welcome. Feel free to convert 
unittests to specs, write documentation or hang out on the ML and IRC 
and help people out.

If you look at the rubyforge stats there is quite a bit of interest in 
this project, but I imagine many people struggle with it and eventually 
move on. That's just... sad, so... anyone?
> Also, nobody react to my proposal to redefine the @_children instance 
> variable into a class variable. I was able to access a child element 
> like that. Was it so silly ?
That way you wouldn't be able to use the same element more than once in 
a template, every instance would share the same children. I don't think 
this is what we want.

On a related note, I do have a patch in my repo 
(http://darcs.arnebrasseur.net/glycerin) that uses a facets dictionary 
to store the children. It's like a hash but with ordering, so you know 
in what order child elements occur.


Arne Brasseur
arne at arnebrasseur.net

More information about the Nitro-general mailing list