Include extra partial in layouts


#1

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


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!


#2

On Jan 15, 2006, at 12:26 PM, Gerard P. 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.


#3

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 … :slight_smile:

Regards,

Gerard.

On Sunday 15 January 2006 21:04, Lori O. tried to type something
like:

Works fine for us.


Rails mailing list
removed_email_address@domain.invalid
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!


#4

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


#5

Jules,

marvelous. I’m so happy … :slight_smile:

Thanx a lot!

Grtz Gerard.

On Sunday 15 January 2006 22:03, Jules tried to type something like:

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!


#6

“shared” is under “views”


#7

Thanx, it’s working.

Got these lovely clean layouts all of a sudden … :wink:

Regards,

Gerard.

On Monday 16 January 2006 02:59, Lori O. tried to type something
like:

<%= render :partial => “shared/header” %>


“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!


#8

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!