On Jul 12, 2007, at 9:23 AM, Jano Svitok wrote: > On 7/12/07, Vadim Shevchenko <veejar.net / gmail.com> wrote: >> For example I have such html-page: >> >> test.html >> ========== >> >> <html> >> <body> >> <% >> puts 'hello' >> %> >> >> <hr> >> >> <?php >> >> phpinfo(); >> >> ?> >> </body> >> </html> >> >> =========== >> >> Main web-server script-language is Ruby. >> I want to include PHP-code. >> >> Is it posiible? > > It is possible if you run the code first through ERB and then through > PHP or vice versa. > > How slow it will be depends on your deployment type - i.e. whether do > you run PHP and/or Ruby as CGI, mod_ruby, using mongrel etc. > > If mod_php allows you to define a post_request filter, that might > help. Or you could create a subrequest to php, and than process its > output. > > I see a maintainability problem here - two languages intermixed. > The easier way would be to separate all the php or ruby stuff to a > separate webservice/subpage, and include its output to the main page. > > ...and if you want to really inter-mix ruby and php, that would be a > nightmare ;-) > as in: > > <% 1..2.each do |i| %> > <?php > > ?> > <% end %> > > J. > I've been thinking about this as well lately. Since Rails is overkill for a lot of little things, it would be nice if ERb had more ability. ERb lacks some of the functionality and flexibility of embedded php. With php you can just include a file, but ERb doesn't let you do that (AFAIK). John Joyce