From: Brian Candler Date: 2009-01-27T05:58:17+09:00 Subject: Re: non-invasive templating solutions in ruby? Terrence Brannon wrote: > whereas in a 'non-invasive' system there would only be HTML with id or > class tags > > > > Hello, does your mother know you're > using her AOL account? > > > Sorry, you're not old enough to enter > (and too dumb to lie about your age) > > > Welcome > > > > and then you would simply remove the parts of the HTML based on age: > > $age->retain('under10') if $age < 10; Amrita works like that. I haven't used it for a long time, and it doesn't appear to have been updated since 2003, but it worked fine then :-) Another option is to do the template insertion client-side in Javascript. For example, Rails Javascript helpers can write the Javascript for you dynamically and send it straight to the client: render :update do |page| page.remove_html 'under18' page.remove_html 'welcome' end (It uses Prototype by default, but by installing jRails then the same Ruby code will generate jQuery javascript instead) The attraction of this approach is that Ajax updates work the same way, and it's a stepping-stone towards making a richer Javascript interface if you want to go that way. -- Posted via http://www.ruby-forum.com/.