Hi Fab,
An example (from the agile dev book) .. In app/views/layouts you put a rhtml
file with the general site layout. And a name related to the controller. e.g.
"store".
<html>
<head>
<title>Prag Prog Books Online Store</title>
<%= stylesheet_link_tag "depot", :media => "all"
%>
</head>
<body>
<div id="banner">
<img src="/images/gp_canv_logo.jpg">
<%= @page_title || "GP-matic Bookshelf" %>
</div>
<div id="columns">
<div id="side">
<a href="http://...">Home</a><br/>
<a href="http://...">Questions</a><br/>
<a href="http://...">News</a><br/>
<a href="http://...">Contact</a><br/>
<a href="/admin">Admin</a><br/>
</div>
<div id="main">
<% if @flash[:notice] -%>
<div id="notice"><%= @flash[:notice]
%></div>
<% end %>
<%= @content_for_layout %> <<<
</div>
</div>
</body>
</html>
The magical line in this template is <%= @content_for_layout %> is picked
up
from any store/filename.rhtml.
The views, in this case, under store all have that layout. So generally in
your views you do not put any site or menu layout kind thingies (they go in
layouts). Views only generate html output containing your actual html
encapsulated data, e.g.
<% for product in @products %>
<div class="catalogentry">
<table border="0"><tr><td width="100"
valign="top">
<img src="<%= product.image_url %>"/>
</td><td valign="top">
<h3><%=h product.title %></h3>
<% product.description %>
<span class="catalogprice"><%=
number_to_currency(product.price)
%></span><br/><br
/>
<%= link_to ''Add to Cart'',
{:action => ''add_to_cart'', :id => product },
:class => ''addtocart'' %><br/>
</td></tr></table>
</div>
<div class="separator"> </div>
<% end %>
Hope it helps.
Gerard.
On Saturday 24 December 2005 12:45, Fab Psycho tried to type something
like:> Hi,
>
> I''m releasing my first rails application and I''d like
to have a common
> menu in all my templates.
> Do I have to include an rhtml from .rb or other rhtml ? Some sample code
> pls ?
>
> Regards,
> Fabian
>
>
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.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!