The embedding techniques just make it slightely more
simple. Its annoying having to write
#!/usr/local/bin/ruby at the beginning of every file.
The way I have done it since i've been using php.

Include:
-template class
-dba class
-logic classes
-init objects
-get objects to get data from db
-pass that data in strings to template object.
-output

I guess i never thought about doing it without
embedding but now that i do think about it its not
really necessary. I'm porting the code over from
PHPLibs template class to ruby. I'll have to modify it
a bit so I can use it in a plain cgi environment. btw
if anyone is interested in using it once its done just
send me an email and i'll let you know when im done.

Cheers,
Billy

--- "Daniel P. Zepeda" <daniel / zepeda-zone.net> wrote:
> Personally, I don't see the advantage of using the
> embedding techniques. Forget for the moment that it
> is bad coding practice to mix your logic with the
> design, I've done quite well using something like
> this:
> 
>
http://www.rubycookbook.org/showrecipe.rb?sessionID=S4zJv47J6c1f3jaL&recipeID=137
> 
> It has been awhile since I wrote that. Since then
> I've found it easier to set up all the forms and
> other interactive content into variables that you
> then place on the page using CSS. That is, I tuck
> most of the heavy processing away in an object that
> interfaces with the content (database, whatever),
> then use the ASP-ish page to create the object which
> takes care of the session data, the database
> connectivity, etc, use that object by calling its
> methods, which return html in a string variable,
> which you use to place the HTML on the page using
> CSS to position and control the look.  This way, you
> have the separation of logic and interface: you get
> very short, ASP-ish pages where you can manipulate
> the placement of the content that was generated by
> the processing object, which can be changed, say
> from using one database to another, without
> disturbing the presentation pages. No fooling with
> erb or eruby *plus* you get the power of the CGI
> object to aid in handling cookies, sessio!
> ns etc. *and*  finally, a more portable program,
> since you don't have to worry about if erb|eruby is
> installed, configured properly, etc.  I find this
> simple, flexible approach superior to the embedding
> techniques, which IMHO are just carrying over bad
> programming practices from Microsoft, whom probably
> stole the idea from someone else anyway. 
> 
> BTW, I also use this approach with Perl, and all the
> same comments apply. 
> 
> On Fri, 22 Feb 2002 07:41:56 +0900
> m_seki / mva.biglobe.ne.jp wrote:
> 
> > 
> > Hi,
> > 
> > > I would like to use either of eRuby or erb for
> my web design.
> > > What's the difference?
> > > Do you use both for the same program?
> > > Which one is better in which case?
> > 
> > It is dependent on your application.
> > 
> > > Please tell us your experience?
> > 
> > 
> > NaHi's post is detailed about eruby and erb.
> > 
> > *
>
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/2734
> 
> 
> -- 
> Daniel P. Zepeda
> daniel / zepeda-zone.net


__________________________________________________
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com