How can I use views and layouts with Ruby and ERB (not Rails)?

前端 未结 4 581
闹比i
闹比i 2020-12-20 06:08

How can I use views and layouts with Ruby and ERB (not Rails)?

Today i\'m using this code to render my view:

def render(template_path, context = sel         


        
4条回答
  •  醉话见心
    2020-12-20 06:21

    If you are using Sinatra so it has a good docimentation and one of the topics it's nested layouts (see Sinatra README)

    Also good idea to use special default layout file (layout.haml or layout.erb in your view directory) This file will be always use to render others. This is example for layout.haml:

    !!!5
    %html
      %head
        ##
      %body
        =yield ## THE OTHER LAYOUTS WILL BE DISPALYED HERE
        %footer
          # FOOTER CONTENT
    

提交回复
热议问题