Results 1 to 7 of 7
Thread: PHP style include
Jun 7, 2006, 06:45 #1
PHP style include
How do you do an include in a view using a url similar to a php include. I need to pull a common nav bar using a URL and in PHP of course I'd do
Jun 7, 2006, 06:47 #2
Jun 7, 2006, 07:08 #3Originally Posted by vgarcia
render ( : partial=>"http://www.domain.com/inc/nav_bar.php")
gives an error about @nav_bar.php not being a valid instance variable name.
I'm feeling very dense about this problem. Am I missing something as an option?Erh
Jun 7, 2006, 07:11 #4
You can't do includes through HTTP that way. Partials provide "include" functionality, but it's done in a different way than a PHP include is.
Why not just stick your navigation in a layout? Then you still get the benefit of only having one place to edit it for a sitewide change.
Jun 7, 2006, 07:18 #5Originally Posted by vgarcia
So currently there is no way in Rails or Ruby to do this?Erh
Jun 7, 2006, 07:25 #6
in environment.rb (or whever you want)
require 'net/http' require 'uri'
<%= Net::HTTP.get URI.parse("http://www.domain.com/inc/nav_bar.php") %>Erh
Jun 7, 2006, 07:49 #7
- Join Date
- Aug 2005
- 0 Post(s)
- 0 Thread(s)
I think it is wise to cache that...