• Java IO
  • JavaScript
  • PHP
  • JSP
  • Spring
  • RubyonRails
  • Core Java
  • Struts
  • Servlet

  • <

    Ruby on Rails Layout


    A layout defines the surroundings of an HTML page. It's the place to define a common look and feel of your final output. Layout files reside in app/views/layouts.
    The process involves defining a layout template and then letting the controller know that it exists and to use it. First, let's create the template.
    Add a new file called standard.html.erb to app/views/layouts. You let the controllers know what template to use by the name of the file, so following a same naming scheme is advised.

    Example



    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
     
    <html xmlns = "http://www.w3.org/1999/xhtml"> 
     
       <head> 
          <meta http-equiv = "Content-Type" content = "text/html; charset = iso-8859-1" /> 
          <meta http-equiv = "Content-Language" content = "en-us" /> 
          <title>Library Info System</title>  
          <%= stylesheet_link_tag "style" %> 
       </head> 
     
       <body id = "library"> 
          <div id = "container"> 
              
             <div id = "header"> 
                <h1>Library Info System</h1> 
                <h3>Library powered by Ruby on Rails</h3> 
             </div> 
     
             <div id = "content"> 
                <%= yield -%> 
             </div> 
     
             <div id = "sidebar"></div> 
              
          </div> 
       </body> 
       
    </html> 
    
















    © copyright 2017-2021 Completedone pvt ltd.