<div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div bgcolor="#ffffff" text="#000000"><tt>class Box &lt; Raw::Element<br>
&nbsp; def open<br>
&nbsp;&nbsp;&nbsp; %|&lt;div style=&quot;color: #@color&quot;&gt;|<br>
&nbsp; end<br>
<br>
&nbsp; def close<br>
&nbsp;&nbsp;&nbsp; &quot;&lt;/div&gt;&quot;<br>
&nbsp; end<br>
end</tt></div></blockquote><div><br><br>Elements are evaluated at &quot;compile time&quot; ie when the page is loaded for the first time. However, you can&nbsp; achieve dynamic effects, let me give you an example:<br><br>class Box &lt; Raw::Element
<span style="font-family: monospace;"><br></span>&nbsp;&nbsp; def render<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; %{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;div style=&quot;color: \#{@color}&quot;&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #{content}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/div&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp; end<br>end<br><br>then use it like this:
<br><br>&lt;?r<br>colors = [ &quot;#ff0&quot;, &quot;#f00&quot;, &quot;#00f&quot;, #&quot;0ff&quot; ]<br>?&gt;<br>&lt;h1&gt;Dynamic boxes&lt;/h1&gt;<br><br>&lt;Box color=&quot;colors[rand(colors.size)]&quot;&gt;<br>&nbsp;&nbsp; This box is randomly colored ;-)
<br>&lt;/Box&gt;<br></div></div><br><br>-g.<br clear="all"><br>-- <br><a href="http://phidz.com">http://phidz.com</a><br><a href="http://blog.gmosx.com">http://blog.gmosx.com</a><br><a href="http://cull.gr">http://cull.gr
</a><br><a href="http://www.joy.gr">http://www.joy.gr</a><br><a href="http://nitroproject.org">http://nitroproject.org</a>