Hi all, Does anybody know how to include a partial (next to @content_for_layout) in a layout file? I''m looking for a something like @partial_for_include => ''filename'' in my layout files. So a linked .rhtml file gets picked up from within a layout file. All my layout files (4 at the moment) have a <div class="navright"> tag, so one change in the menu, means editing 4 files. Any clue? THANX! Gerard. -- "Who cares if it doesn''t do anything? It was made with our new Triple-Iso-Bifurcated-Krypton-Gate-MOS process ..." My $Grtz =~ Gerard; ~ :wq!
On Jan 15, 2006, at 12:26 PM, Gerard Petersen wrote:> Hi all, > > Does anybody know how to include a partial (next to > @content_for_layout) in a > layout file? >You mean like this? <body> <%= render :partial => "shared/header" %> <div id="Body"> <%= @content_for_layout %> </div> <%= render :partial => "shared/navbar" %> <%= render :partial => "shared/footer" %> </body> Works fine for us.
Lori, Brilliant! I already have navigation menu''s in several layouts, and I''m about to start on all those cross-browser hack''s, which is going to result in at least 15 headers in multiple files. Thanks for making my life easy .. :-) Regards, Gerard. On Sunday 15 January 2006 21:04, Lori Olson tried to type something like:> On Jan 15, 2006, at 12:26 PM, Gerard Petersen wrote: > > Hi all, > > > > Does anybody know how to include a partial (next to > > @content_for_layout) in a > > layout file? > > You mean like this? > > <body> > > <%= render :partial => "shared/header" %> > > <div id="Body"> > <%= @content_for_layout %> > </div> > > <%= render :partial => "shared/navbar" %> > > <%= render :partial => "shared/footer" %> > </body> > > Works fine for us. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-- "Who cares if it doesn''t do anything? It was made with our new Triple-Iso-Bifurcated-Krypton-Gate-MOS process ..." My $Grtz =~ Gerard; ~ :wq!
Lori, Any clue on what the directory is above ''shared'' (the layout ''root'' so to speak). I created some files and moved the content, and on this line:> <%= render :partial => "shared/header" %>it now says: ActionView::ActionViewError in Crm/customer#list_contacts No rhtml, rxml, or delegate template found for shared/_navright Thanx again. Gerard. -- "Who cares if it doesn''t do anything? It was made with our new Triple-Iso-Bifurcated-Krypton-Gate-MOS process ..." My $Grtz =~ Gerard; ~ :wq!
Does this file exist: app/views/shared/_navright.rhtml ?? If you use render :partial => ''..'' Rails prepends a ''_'' because it is a partial: all partials have a _ before their name, but render :partial => ''..'' expects the name without a _. so: render :partial => ''shared/abc'' Looks for: views/shared/_abc.rhtml Jules -- Posted via http://www.ruby-forum.com/.
Jules, marvelous. I''m so happy .. :-) Thanx a lot! Grtz Gerard. On Sunday 15 January 2006 22:03, Jules tried to type something like:> Does this file exist: > > app/views/shared/_navright.rhtml > > ?? > > If you use render :partial => ''..'' Rails prepends a ''_'' because it is a > partial: all partials have a _ before their name, but render :partial => > ''..'' expects the name without a _. > > so: > > render :partial => ''shared/abc'' > > Looks for: > > views/shared/_abc.rhtml > > Jules-- "Who cares if it doesn''t do anything? It was made with our new Triple-Iso-Bifurcated-Krypton-Gate-MOS process ..." My $Grtz =~ Gerard; ~ :wq!
"shared" is under "views" On Jan 15, 2006, at 2:00 PM, Gerard Petersen wrote:> Lori, > > Any clue on what the directory is above ''shared'' (the layout ''root'' > so to > speak). > > I created some files and moved the content, and on this line: >> <%= render :partial => "shared/header" %> > > it now says: > > ActionView::ActionViewError in Crm/customer#list_contacts > > No rhtml, rxml, or delegate template found for shared/_navright > > Thanx again. > > Gerard. > > -- > "Who cares if it doesn''t do anything? It was made with our new > Triple-Iso-Bifurcated-Krypton-Gate-MOS process ..." > > My $Grtz =~ Gerard; > ~ > :wq! > > >
Thanx, it''s working. Got these lovely clean layouts all of a sudden .. ;-) Regards, Gerard. On Monday 16 January 2006 02:59, Lori Olson tried to type something like:> "shared" is under "views" > > On Jan 15, 2006, at 2:00 PM, Gerard Petersen wrote: > > Lori, > > > > Any clue on what the directory is above ''shared'' (the layout ''root'' > > so to > > speak). > > > > I created some files and moved the content, and on this line: > >> <%= render :partial => "shared/header" %> > > > > it now says: > > > > ActionView::ActionViewError in Crm/customer#list_contacts > > > > No rhtml, rxml, or delegate template found for shared/_navright > > > > Thanx again. > > > > Gerard. > > > > -- > > "Who cares if it doesn''t do anything? It was made with our new > > Triple-Iso-Bifurcated-Krypton-Gate-MOS process ..." > > > > My $Grtz =~ Gerard; > > ~ > > > > :wq!-- "Who cares if it doesn''t do anything? It was made with our new Triple-Iso-Bifurcated-Krypton-Gate-MOS process ..." My $Grtz =~ Gerard; ~ :wq!