Can I get RubyOnRails to read and parse an html file off har

I do this in ASP to read a special html template that I use, then modify
in
code before spitting out the resulting webpage.

Any ideas on how to script this in RUBY? Do I need a special GEM
package?

D. Bruce M.

Hi Bruce,

This is in essence what the “view” files are for.

Check out the tutorials and docs linked on this page:

http://www.rubyonrails.com/docs

for help understanding how the framework works. It really is deceptively
simple.

Best of luck and have fun…

Nicholas

Thanks, Nicholas!

I have looked over the VIEWS documentation and I find that I still want
to
be able to read an html file and handle the output myself.

Can this be done? Code suggestions?

D. Bruce M., BA, BGS, Dipl, MCP
www.Gracenote.ca
Winnipeg, MB
(204) 772-5483

You can store templates anywhere (in the view dir, elsewhere on the
server, in a database, on another server) and process them anyway
you’d like before returning them to the client.

You can do any processing you want using Ruby. I’m assuming the
processing code would go in the Controller.

If you want to wrap common output in simple functions, you can use
helpers, and there’s a templating language called Radius:


Austin G.
Thinking & Making: IA, UX, and IxD
http://thinkingandmaking.com
[email protected]

Hi Bruce,

D. Bruce M. wrote:

… to read a special html template that I use,
then modify in code before spitting out the
resulting webpage.

One approach would be to use REXML to read / write the file, then use
'render :file => … ’ to display the web page.

hth,
Bill

Thanks Austin!

What I want to do is use my favourite html editor and embed my own (not
use
the “<%”) tags for some specialized content.

I do NOT want to use the “<%” stuff as the formatting looks wrong in my
html
editor. If I create my own template methodology (did this easy in ASP)
my
productivity goes up significantly.

I tried using Files.open but got some error…do I need to install some
GEM
or something to use FILES commands?

D. Bruce M., BA, BGS, Dipl, MCP
www.Gracenote.ca
Winnipeg, MB
(204) 772-5483

On 8/17/06, D. Bruce M. [email protected] wrote:

productivity goes up significantly.
Are you sure you want to use Rails then? Seems like you lose a lot of
the
benefits of Rails by not using the Ruby commands inside your view files.
There are html editors that will show the ruby codes nicely in your
rhtml
files.

I tried using Files.open but got some error…do I need to install some
GEM

or something to use FILES commands?

No, just plain Ruby should work. Try the commands out using irb
(interactive
ruby at command line) to try to figure out what problem you might be
facing.
Then once you’ve nailed it down, integrate the commands into your code.

I agree, you need to go back to .asp if you don’t like rails views

Bill wrote:

Charlie B. wrote:

I agree, you need to go back to .asp if you don’t like rails views

I disagree with that. I recall seeing a markup for Rails that was HTML
editor friendly. Was it Markaby or something else? It was specifically
created to allow designers to work with the Rails templates.

Anyone recall what I’m referring to?

Bill

I’ll answer my question. It was Masterview but the site appears to not
be responding. I can see it in google’s cache.

Bill

Charlie B. wrote:

I agree, you need to go back to .asp if you don’t like rails views

I disagree with that. I recall seeing a markup for Rails that was HTML
editor friendly. Was it Markaby or something else? It was specifically
created to allow designers to work with the Rails templates.

Anyone recall what I’m referring to?

Bill

MasterView site ( http://masterview.org/ ) was intermittently down as
we were upgrading some sites to be compatible with rails 1.1.6. We are
done with the upgrades other than a hardware issue I am having tech
support look at. I wouldn’t expect much downtime from this.

Let me know if you are still having trouble getting to the site.

Also note that project is stored on Rubyforge.org so one can always
pull gem from there.
http://rubyforge.org/projects/masterview

Thanks,

Jeff