Ruby like Php

G

Giuseppe Caruso

Hi, I am studying Ruby for web development and I was guessing if there
is a way to use Ruby, embedded into the html code like one can do with
Php.
I know that this could not be such a popular topic here, but I think it
would be really great to use it "on the fly" in web pages.
I knew that mod_ruby is practically abandoned, could Phusion Passenger
be a solution?
 
P

Paolo Montrasio

Giuseppe said:
Hi, I am studying Ruby for web development and I was guessing if there
is a way to use Ruby, embedded into the html code like one can do with
Php.
I know that this could not be such a popular topic here, but I think it
would be really great to use it "on the fly" in web pages.
I knew that mod_ruby is practically abandoned, could Phusion Passenger
be a solution?

You may want to look at ERb (embedded Ruby) or at frameworks like Rails
(which uses ERb).

In both ways you'll end up writing html pages with Ruby code embedded
between <% %> pairs.

Paolo
 
T

Tony Arcieri

[Note: parts of this message were removed to make it a legal post.]

Hi, I am studying Ruby for web development and I was guessing if there
is a way to use Ruby, embedded into the html code like one can do with
Php.
I know that this could not be such a popular topic here, but I think it
would be really great to use it "on the fly" in web pages.
I knew that mod_ruby is practically abandoned, could Phusion Passenger
be a solution?


Phusion Passenger works much like PHP in that you can just point Apache at
any Rack-based application and Passenger will automagically make it work
just like PHP.
 
G

Giuseppe Caruso

Tony said:
Phusion Passenger works much like PHP in that you can just point Apache
at
any Rack-based application and Passenger will automagically make it work
just like PHP.

Tony, please, edit the post to delete my email address… :p

I mean, is there a way to use Ruby like I can do on every webhosting
service out there?
i.e. why I can't just write:

<p>What time is it? it is <%= Time.now %></p>

like I can do with Php?
 
J

Justin Collins

Giuseppe said:
Tony, please, edit the post to delete my email address… :p

I mean, is there a way to use Ruby like I can do on every webhosting
service out there?
i.e. why I can't just write:

<p>What time is it? it is <%= Time.now %></p>

like I can do with Php?

You can do that because they have mod_php set up for you. If your
hosting service does not have mod_ruby, but you have shell access, you
may be able to (as I have) set up eruby to be used for .rhtml files
through your .htaccess file.

-Justin
 
G

Giuseppe Caruso

Justin said:
You can do that because they have mod_php set up for you. If your
hosting service does not have mod_ruby, but you have shell access, you
may be able to (as I have) set up eruby to be used for .rhtml files
through your .htaccess file.

-Justin

Justin, thanks.
Can you provide me a link to a tutorial/documentation to install it?
Can I also install Haml?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,736
Latest member
zacharyharris

Latest Threads

Top