How are you gentlemen? I have a view where I need to render some HTML stored in site.html_code <%= site.html_code %> The problem is, when I do that, it changes all the links on the rest of the page that are pulled in by layout. So instead of my "Home" link pointing to "/main/index", it''ll now point to "URL_FROM_site.html_code/http://localhost:3000/main/index". I figure I can go in and change the navigation links in the layout, but is there a way to just "contain" the HTML from site.html_code so that it doesn''t affect the rest of the page. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
Joe Peck wrote:> is there a way to just "contain" the HTML from site.html_code so that it > doesn''t affect the rest of the page.How are you displaying the views in your layout? Regardless of what you are rendering in the layout, the links shouldn''t be changing. I have views with links in them that don''t randomly change. Sounds like you might have some kind of HTML formatting issue. In my views I render the content by: <%=@content_for_layout%> Are you doing something similar? If html_code is a partial you want to say: <%= render :partial => ''html_code'' %> -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
> How are you displaying the views in your layout? Regardless of what you > are rendering in the layout, the links shouldn''t be changing. I have > views with links in them that don''t randomly change. Sounds like you > might have some kind of HTML formatting issue. In my views I render the > content by: > > <%=@content_for_layout%> > > Are you doing something similar? If html_code is a partial you want to > say: > > <%= render :partial => ''html_code'' %>I''m rendering the content in the layout like this: <%= yield -%> When I render site.html_code, html_code is a column in the Sites table that holds the HTML of that Site. Is there any way to "encapsulate" the rendered HTML code so that it can''t affect the rest of the page? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
> > I''m rendering the content in the layout like this: > <%= yield -%> > > When I render site.html_code, html_code is a column in the Sites table > that holds the HTML of that Site. Is there any way to "encapsulate" the > rendered HTML code so that it can''t affect the rest of the page?I render "html_code" like this: <%= @site.html_code %> Somehow, it is changing the nav-links in my layout. Might it have something to do that the "html_code" is all the HTML from a Wayback result for the site? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
On 5 Sep 2008, at 16:59, Joe Peck wrote:> >> >> I''m rendering the content in the layout like this: >> <%= yield -%> >> >> When I render site.html_code, html_code is a column in the Sites >> table >> that holds the HTML of that Site. Is there any way to >> "encapsulate" the >> rendered HTML code so that it can''t affect the rest of the page? > > I render "html_code" like this: > <%= @site.html_code %> > > Somehow, it is changing the nav-links in my layout. Might it have > something to do that the "html_code" is all the HTML from a Wayback > result for the site?It could conceivably make the browser do all sorts of things if what you end up with is invalid html (unclosed tags etc...) or html designed for a different doctype than your page. If it''s just all the html from wayback (including for example the head or body tags) then it''s going to be very yucky. sticking it in a frame/iframe might be workable. Fred --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> > It could conceivably make the browser do all sorts of things if what > you end up with is invalid html (unclosed tags etc...) or html > designed for a different doctype than your page. If it''s just all the > html from wayback (including for example the head or body tags) then > it''s going to be very yucky. sticking it in a frame/iframe might be > workable. > > FredThanks, it looks like iframes are the solution for me. Only thing is, I''m having trouble getting it to just put @site.html_code inside the iframe. Somehow, it keeps thinking that @site is a nil object. <iframe src="<%= @site.raw_content.homepage_content %>" width="100%" height="600 px"> </iframe> Hmm, time to try to find out how to do this. If anyone has any ideas, I am all ears. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
Okay, I figured it out. "src" has to be a URL, so I just did this. <iframe src="<%= url_for :action => :show_site_html_code, :site_id => @site.id %>" width="100%" height="700 px"> </iframe> Then in the controller: def show_site_html_code @site = Site.find_by_id(params[:site_id]) render(:layout => false) end Hopefully this can help someone else who wants to know how to use iframes with rails like this. Good thread to read right here: http://www.ruby-forum.com/topic/144196#new -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---