From: John Joyce Date: 2007-07-13T08:54:11+09:00 Subject: Re: Ruby and PHP code in html-page --Apple-Mail-1--181183785 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed On Jul 12, 2007, at 6:25 PM, Jeremy Henty wrote: > On 2007-07-12, John Joyce wrote: >> >> On Jul 12, 2007, at 4:50 PM, Jeremy Henty wrote: >> >>> <%= ERB.new(IO.read("how_about_this_then.erb")).result(binding) %> >>> >> That's OK I guess, but it's not as graceful as usual Ruby things. > > I agree, though you can pretty it up somewhat (as is pointed out > elsewhere in this thread). > >> I guess I'm going to look into Camping and those others. > > I've not yet decided if my head is twisted enough to survive being > wrapped around one of _why's frameworks. :-) > > Jeremy Henty > Well I looked at Camping again. No. _why's stuff is sometimes bent on mental tangents of playfulness. The file is one big mess. Also it requires ActiveRecord, which is of course a marvel of marvels, but I'm trying to do the simple PHP type of includes. I got this to work fine: <%= File.open('links.rhtml').readlines %> Along with this: <% Dir.chdir('images') %> <% Dir.glob("*").each do |img| %>

/>
<%= img.to_s %>

<% end %> The images seem to load slowly, which is odd, since they're actually being served from the file system. The ERb stuff just renders the html based on what's there in the directory. So far so good. Your hints actually helped me think about ERb in terms of standard Ruby rather than the prolific Rails views which include lots of Rails-specific methods. This is most promising, and I think I will begin posting some tutorials on it so others can apply it. Thanks ya'll, I don't know why ERb never clicked before, but now it makes sense suddenly! I can finally knock out simple stuff for a friend of mine to upload images to his simple site without him being hassled by the details of web design. Now I just need to add some RMagick to thumbnail things and some YAML to store metadata on the images and thumbnails and just a little directory structure to make things organized. This is gonna be much better for me than Rails. John Joyce --Apple-Mail-1--181183785--