I''m busy trying to bang out a new version of the website for my fantasy baseball league (www.ibl.org) and I''m torn as to what to do. I''m a PHP coder by day (Zend Certified and everything) but like Rails too. Now, the site is morphing into a "blog plus tools for league members" site. A lot of those tools are already written in PHP and I don''t want to rewrite them to work with Rails as, well, I don''t see the point in reinventing the wheel. So, I''d like to use Rails for the blog and any brand new features we add, but want to still use the PHP code I wrote before. The main goal here is to wrap the Rails code and the PHP code within the same website. Look and feel need to be consistent, so the thought of having to maintain two different sets of templates for output (one for Rails and one for PHP) is not appealing. Can anyone give me some tips on getting the two to play nicely together or point me to some interesting links on the topic? Being a pragmatic guy, I can''t see why these two can''t play nice together. Chris Hartjes -- Posted via http://www.ruby-forum.com/.
Chris Hartjes wrote:> I''m busy trying to bang out a new version of the website for my fantasy > baseball league (www.ibl.org) and I''m torn as to what to do. I''m a PHP > coder by day (Zend Certified and everything) but like Rails too. > > Now, the site is morphing into a "blog plus tools for league members" > site. A lot of those tools are already written in PHP and I don''t want > to rewrite them to work with Rails as, well, I don''t see the point in > reinventing the wheel. So, I''d like to use Rails for the blog and any > brand new features we add, but want to still use the PHP code I wrote > before. The main goal here is to wrap the Rails code and the PHP code > within the same website. Look and feel need to be consistent, so the > thought of having to maintain two different sets of templates for output > (one for Rails and one for PHP) is not appealing. > > Can anyone give me some tips on getting the two to play nicely together > or point me to some interesting links on the topic? Being a pragmatic > guy, I can''t see why these two can''t play nice together. > > Chris HartjesThis is what I did to get Mint (PHP) and Typo (Rails) to sit next to each other nicely in lighttpd: # Start of sporkmonger vhost $HTTP["host"] =~ "www.sporkmonger\.(com|net|org)" { url.redirect = ( "^/(.*)" => "http://sporkmonger.com/$1", "" => "http://sporkmonger.com/" ) } $HTTP["host"] =~ "^sporkmonger\.(com|net|org)" { server.document-root = "/home/vacindak/sites/sporkmonger/public/" accesslog.filename = "/home/vacindak/sites/sporkmonger/log/lighttpd.access.log" server.errorlog = "/home/vacindak/sites/sporkmonger/log/lighttpd.error.log" server.indexfiles = ( "index.php", "index.html", "index.htm", "default.htm" ) expire.url = ( "/files/" => "access 2 hours" ) server.error-handler-404 = "/dispatch.fcgi" url.redirect = ( "^/sitemap.atom.xml$" => "http://www.sporkmonger.com/xml/atom03/feed.xml", "^/xml/rss/feed.xml$" => "http://www.sporkmonger.com/xml/rss20/feed.xml", "^/xml/atom/feed.xml$" => "http://www.sporkmonger.com/xml/atom10/feed.xml" ) url.access-deny = ( "~", ".inc" ) # rails stuff #### fastcgi module fastcgi.server = ( ".fcgi" => ( "sporkmonger" => ( "socket" => "/tmp/sporkmonger.fcgi.socket", "bin-path" => "/home/vacindak/sites/sporkmonger/public/dispatch.fcgi", "bin-environment" => ( "RAILS_ENV" => "production" ), "max-load-per-proc" => 25, "min-procs" => 1, "max-procs" => 1, "idle-timeout" => 60 ) ), ".php" => ( "sporkmonger-mint" => ( "socket" => "/tmp/sporkmonger-mint.fcgi.socket", "min-procs" => 1, "max-procs" => 1, "bin-path" => "/usr/local/www/cgi-bin/php5-fcgi", "bin-environment" => ( "PHP_FCGI_CHILDREN" => "1", "PHP_FCGI_MAX_REQUESTS" => "100" ) ) ) ) } # End of sporkmonger vhost Not sure if it''ll help, but you''re welcome to give it a try. Cheers, Bob Aman -- Posted via http://www.ruby-forum.com/.
I think it depends on how tightly integrated you want them to be. I don''t think you''ll be able to call a PHP function/object from within Ruby - or you might be able to, but I''m reasonably sure that you''d be better off implementing it in Ruby. But, if you want some links/pages/content to use PHP and some to use Rails, you may be able to do that. Many Rails hosts are using the /some-dir symlinked to /rails-app/public trick. In that way, you could have you Rails code live at some-dir and your PHP live at the site root. You could do something similar with subdomains: "oldwww.mydomain.com" "/home/you/old-site-with-php", "newwww.mydomain.com" "/home/you/new-site-with-rails/public" . On 3/7/06, Chris Hartjes <chartjes@gmail.com> wrote:> > I''m busy trying to bang out a new version of the website for my fantasy > baseball league (www.ibl.org) and I''m torn as to what to do. I''m a PHP > coder by day (Zend Certified and everything) but like Rails too. > > Now, the site is morphing into a "blog plus tools for league members" > site. A lot of those tools are already written in PHP and I don''t want > to rewrite them to work with Rails as, well, I don''t see the point in > reinventing the wheel. So, I''d like to use Rails for the blog and any > brand new features we add, but want to still use the PHP code I wrote > before. The main goal here is to wrap the Rails code and the PHP code > within the same website. Look and feel need to be consistent, so the > thought of having to maintain two different sets of templates for output > (one for Rails and one for PHP) is not appealing. > > Can anyone give me some tips on getting the two to play nicely together > or point me to some interesting links on the topic? Being a pragmatic > guy, I can''t see why these two can''t play nice together. > > Chris Hartjes > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060307/a4f31bb6/attachment-0001.html
I''m doing the opposite on Dreamhost... I have a wordpress blog in the public folder of my Rails application. Everything seems to work just fine there. I don''t recall if I had to do anything special to make that work... I believe that the default htaccess worked fine, as the php page were handled by Apache instead of the dispatch.fcgi. -----Original Message----- From: rails-bounces@lists.rubyonrails.org [mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of Josh on Rails Sent: Tuesday, March 07, 2006 9:21 AM To: rails@lists.rubyonrails.org Subject: Re: [Rails] Can Ruby and PHP play nice together? I think it depends on how tightly integrated you want them to be. I don''t think you''ll be able to call a PHP function/object from within Ruby - or you might be able to, but I''m reasonably sure that you''d be better off implementing it in Ruby. But, if you want some links/pages/content to use PHP and some to use Rails, you may be able to do that. Many Rails hosts are using the /some-dir symlinked to /rails-app/public trick. In that way, you could have you Rails code live at some-dir and your PHP live at the site root. You could do something similar with subdomains: "oldwww.mydomain.com" "/home/you/old-site-with-php", "newwww.mydomain.com " "/home/you/new-site-with-rails/public" . On 3/7/06, Chris Hartjes <chartjes@gmail.com > wrote: I''m busy trying to bang out a new version of the website for my fantasy baseball league (www.ibl.org) and I''m torn as to what to do. I''m a PHP coder by day (Zend Certified and everything) but like Rails too. Now, the site is morphing into a "blog plus tools for league members" site. A lot of those tools are already written in PHP and I don''t want to rewrite them to work with Rails as, well, I don''t see the point in reinventing the wheel. So, I''d like to use Rails for the blog and any brand new features we add, but want to still use the PHP code I wrote before. The main goal here is to wrap the Rails code and the PHP code within the same website. Look and feel need to be consistent, so the thought of having to maintain two different sets of templates for output (one for Rails and one for PHP) is not appealing. Can anyone give me some tips on getting the two to play nicely together or point me to some interesting links on the topic? Being a pragmatic guy, I can''t see why these two can''t play nice together. Chris Hartjes -- Posted via http://www.ruby-forum.com/. _______________________________________________ Rails mailing list Rails@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060307/b75142bf/attachment.html
If your webserver is configured for rails but also for php then you can just put any php files or apps in your public dir and they will just work. -Ezra On Mar 7, 2006, at 7:29 AM, Hogan, Brian P. wrote:> I''m doing the opposite on Dreamhost... I have a wordpress blog in > the public folder of my Rails application. Everything seems to work > just fine there. > > I don''t recall if I had to do anything special to make that work... > I believe that the default htaccess worked fine, as the php page > were handled by Apache instead of the dispatch.fcgi. > > > -----Original Message----- > From: rails-bounces@lists.rubyonrails.org [mailto:rails- > bounces@lists.rubyonrails.org] On Behalf Of Josh on Rails > Sent: Tuesday, March 07, 2006 9:21 AM > To: rails@lists.rubyonrails.org > Subject: Re: [Rails] Can Ruby and PHP play nice together? > > I think it depends on how tightly integrated you want them to be. I > don''t think you''ll be able to call a PHP function/object from > within Ruby - or you might be able to, but I''m reasonably sure that > you''d be better off implementing it in Ruby. > > But, if you want some links/pages/content to use PHP and some to > use Rails, you may be able to do that. > > Many Rails hosts are using the /some-dir symlinked to /rails-app/ > public trick. In that way, you could have you Rails code live at > some-dir and your PHP live at the site root. > > You could do something similar with subdomains: > "oldwww.mydomain.com" = "/home/you/old-site-with-php", > "newwww.mydomain.com " = "/home/you/new-site-with-rails/public" . > > > > On 3/7/06, Chris Hartjes <chartjes@gmail.com > wrote: I''m busy > trying to bang out a new version of the website for my fantasy > baseball league (www.ibl.org) and I''m torn as to what to do. I''m a > PHP > coder by day (Zend Certified and everything) but like Rails too. > > Now, the site is morphing into a "blog plus tools for league members" > site. A lot of those tools are already written in PHP and I don''t > want > to rewrite them to work with Rails as, well, I don''t see the point in > reinventing the wheel. So, I''d like to use Rails for the blog and any > brand new features we add, but want to still use the PHP code I wrote > before. The main goal here is to wrap the Rails code and the PHP code > within the same website. Look and feel need to be consistent, so the > thought of having to maintain two different sets of templates for > output > (one for Rails and one for PHP) is not appealing. > > Can anyone give me some tips on getting the two to play nicely > together > or point me to some interesting links on the topic? Being a pragmatic > guy, I can''t see why these two can''t play nice together. > > Chris Hartjes > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-Ezra Zygmuntowicz Yakima Herald-Republic WebMaster http://yakimaherald.com 509-577-7732 ezra@yakima-herald.com
That''s not the issue here really. The webserver can run both PHP and Rails apps, I just want to be able to have them running as part of the same app, same look-and-feel without having to maintain two sets of templates. Ezra Zygmuntowicz wrote:> If your webserver is configured for rails but also for php then you > can just put any php files or apps in your public dir and they will > just work. > > -Ezra > > On Mar 7, 2006, at 7:29 AM, Hogan, Brian P. wrote: > >> From: rails-bounces@lists.rubyonrails.org [mailto:rails- >> But, if you want some links/pages/content to use PHP and some to >> >> to rewrite them to work with Rails as, well, I don''t see the point in >> or point me to some interesting links on the topic? Being a pragmatic >> >> _______________________________________________ >> Rails mailing list >> Rails@lists.rubyonrails.org >> http://lists.rubyonrails.org/mailman/listinfo/rails > > -Ezra Zygmuntowicz > Yakima Herald-Republic > WebMaster > http://yakimaherald.com > 509-577-7732 > ezra@yakima-herald.com-- Posted via http://www.ruby-forum.com/.
On 3/7/06, Chris Hartjes <chartjes@gmail.com> wrote:> > That''s not the issue here really. The webserver can run both PHP and > Rails apps, I just want to be able to have them running as part of the same > app, same look-and-feel without having to maintain two sets of templates. >I''m not aware of an easy way to re-use Rails'' layouts/views in PHP; or vice-versa. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060307/f7cfe22c/attachment.html