From: John Joyce Date: 2007-05-09T08:55:08+09:00 Subject: Re: string substitution On May 9, 2007, at 7:00 AM, Phrogz wrote: > On May 8, 3:36 pm, Barry Abrams wrote: >> I've got a block of html coming in from the database that looks like >> this: >> >>
>> #{@copy_1} >>
> > Does it have to look like that? Could it instead look like this? >
> <%=@copy_1%> >
> > If so, you want ERB. Roughly: > > require 'erb' > template = #...stuff from the DB > html = ERB.new( template ).result > > You might also consider moving the style attributes out of the div elements. Put them in one place. No use repeating the same thing again and again. Ideally even move it all to a style sheet outside of the html. More flexibility.