Just create a file in views called layout.erb (or layout.haml if using haml) output yield where you want the body of the templates to be inserted. Class @variables can also be used.
This allows the basic layout of your site Headers, Footers and navigation panes to be controlled independently, a change in layout.erb is instantly applied across your whole site.
layout.erb
< h t m l>
< h e a d>
< t i t l e><%= @title %>< / t i t l e>
< / h e a d>
< b o d y>
<%= yield %>
< / b o d y>
< / h t m l>
you app.rb (NB: no refference to layour.erb is made)
get '/about/?' do
@title = "About"
erb :about
end
/views/about.erb
Example about page
1 comment:
Thank. you! :)
Post a Comment