Hello, I have discovered the good use of stylesheet_link_tag and javascript_include_tag (I''m still learning) and it is very useful because I have to use the relative_url_root way. Now I wonder how I can use that for other URLs. I want a background image for a table cell so I have to write something like: <td align=''right'' valign=''bottom'' style=''width: 810px; height: 113px; background: url(<% url_for(''images/header.png'')%>) no-repeat center center''>(Of course the css is going to a separate file but the problem stays the same.) What method should I use instead of url_for to do the correct url mapping? link_to does not seem appropriate either. Sorry for all the beginner questions! Bart --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Bart Braem wrote:> I want a background image > for a table cell so I have to write something like: > > <td align=''right'' valign=''bottom'' style=''width: 810px; height: 113px; > background: url(<% url_for(''images/header.png'')%>) no-repeat center center'' > > > > (Of course the css is going to a separate file but the problem stays the > same.) What method should I use instead of url_for to do the correct url > mapping? link_to does not seem appropriate either.If images/header.png is just a static file in your /public directory, there''s no need to use url_for. You only need to use url_for if you want a dynamically-generated URL based on your routes in routes.rb. For a static file, you can just put the URL in directly: <td align=''right'' valign=''bottom'' style=''width: 810px; height: 113px; background: url(/images/header.png) no-repeat center center''> Chris --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Chris Mear wrote:> If images/header.png is just a static file in your /public directory, > there''s no need to use url_for. You only need to use url_for if you > want a dynamically-generated URL based on your routes in routes.rb.But I need a dynamic route here in order to have the relative_url_root url rewriting applied... Can I use url_for then? (Sorry if this is a strange question!) Bart --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---