I’ve already added .rhtml to the php extension in apache’s httpConfig…
what did you think this would do? besides confuse apache even more??
How can one embed PHP into their rhtml files (located in the views
folder?
your best bet is to not embed php in a rhtml file, but to embed it in a
php file, and designate a subdir to use the php interpreter. eg, with
lighttpd:
or you just want to be messy and throw your php files in public/ you
could remove the $HTTP[“url”] =~ “^/php” { and the two lines below it.
im sure apache can do all this…i switched to lighttpd for the concise
and simple configuration. the better performance is just gravy…
How can one embed PHP into their rhtml files (located in the views
folder?
popen() the php interpreter in your view, and display the results
inline. but thats pretty nasty if you ask me…
No, don’t do this. popen() in ruby has very weird issues and will cause
you mountains of problems. The #1, #2, and #3 thing that seems to cause
Rails apps to slow or stop is popen.
On Tue, Jun 06, 2006 at 10:56:10AM +0200, Dominic S. wrote:
How can one embed PHP into their rhtml files (located in the views
folder?
I’d like to use those JD library graphical plugs that use PHP…
I’ve already added .rhtml to the php extension in apache’s httpConfig…
That’s not going to work, as the rhtml file gets interpreted by the
Rails
dispatcher, not Apache. The only thing I can think of is to invoke the
PHP
interpreter inside of Rails, but the resulting tentacles are your own
problem.
For image generation, though, you don’t need to run PHP inside of Rails,
you
just need to point your image src= at the PHP script. But I don’t know
anything about these “JD library graphical plugs”, so maybe you do need
PHP
inside your HTML.
Put the php page in another folder as suggested above and use Ruby’s
net/http library to make the request to your server. This allows yo
uto store this into a string which you can then parse and embed.
Or look for Ruby/Rails based solutions for your problem.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.