Hi all
Is there a rails / ruby function that is analagous to PHPs ‘virtual’
function?
"virtual() is an Apache-specific function which is similar to
in mod_include. It performs an Apache
sub-request. It is useful for including CGI scripts or .shtml files, or
anything else that you would parse through Apache. Note that for a CGI
script, the script must generate valid CGI headers. At the minimum that
means it must generate a Content-type header."
Details:
http://uk.php.net/manual/en/function.virtual.php
Andrew
Andrew K. wrote:
Hi all
Is there a rails / ruby function that is analagous to PHPs ‘virtual’
function?
"virtual() is an Apache-specific function which is similar to
in mod_include. It performs an Apache
sub-request. It is useful for including CGI scripts or .shtml files, or
anything else that you would parse through Apache. Note that for a CGI
script, the script must generate valid CGI headers. At the minimum that
means it must generate a Content-type header."
Details:
PHP: virtual - Manual
Andrew
Rails doesn’t have a facility to communicate directly with apache like
that, however it is very easy to download some html from a url:
include ‘open-uri’
data = open(‘http://yahoo.com’)
more_data = open(‘http://localhost/cgi/somescript.cgi’)
Check out more here:
http://www.ruby-doc.org/stdlib/libdoc/open-uri/rdoc/
That should have been:
include ‘open-uri’
data = open(‘http://yahoo.com’).read
more_data = open(‘http://localhost/cgi/somescript.cgi’).read
Hi there,
From that page:
“This function is only supported when PHP is installed as an Apache
module.”
Maybe mod_ruby has a similar function, but rails doesn’t support
mod_ruby.
Best Regards
Eaden McKee