From: Chad Perrin Date: 2007-03-30T08:40:08+09:00 Subject: Re: simple eruby -- including files On Fri, Mar 30, 2007 at 08:00:52AM +0900, John Joyce wrote: > It really does work pretty much the same way as you would do it with > PHP. > You can make it as simple or as complex as you like. > Use Ruby include or require for the same files. > eRuby is just a lot more concise than PHP is the result. > Your pages become readable again. > It's not different in terms of breaking up files into: > Commonly reused elements (header, navigation, footer, analytics scripts) > Content unique to a page. Could you provide an example? The following, an apparently direct translation from PHP (as far as I can tell), doesn't work. index.rhtml: <% title = "Home" require 'template.rhtml' %> template.rhtml: Welcome <%= title %>

blah blah blah

> > For a simple, fairly static site, you're biggest concern is this > organization of files. > Anything that is the same on multiple pages should get put into a > separate file. I'm aware of this. That's why I'm trying to figure out how to make the above tactic work. > > Of course you can also always just parse files by having the files > written and produced once then storing those, thus saving the > processing time on the server. Not always an option -- but I have used it in the past. -- CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ] Amazon.com interview candidate: "When C++ is your hammer, everything starts to look like your thumb."