007 content for

简介:
在layout/application.rhtml中是一个全局渲染模板,在此模板的html代码中插入
<%= yield%>可以将控制器中对应action的模板嵌入,也可以在application.rhtml模板的框架中留出位置来使用<%= yield  :symbol%>,然后在action模板中使用
<%content_for :symbol do %>
<%=  #content%>
<%end%>
将#content显示在<%= yield  :symbol%>的位置
 
例如:
在application.rhmtl中:
 
在index.rhtml中:
 
最终渲染结果的html代码:
 




本文转自 fsjoy1983 51CTO博客,原文链接:http://blog.51cto.com/fsjoy/113290,如需转载请自行联系原作者
目录
相关文章
|
XML JSON 前端开发
详解Http的Content-Type
1.概述 HTTP(HyperText Transfer Protocol),超文本传输协议。超文本(Hypertext)是一种结构化的文本,其中包含了超链接(Hyperlink)的能力,通过超链接可以在不同文档之间创建关联和跳转。 传统的文本是线性的,按照一定的顺序排列的,而超文本则打破了线性结构,允许文本中的某些词、短语或图像与其他文档或资源之间建立关联。这些关联通过超链接来实现,用户可以点击超链接来跳转到其他相关的文档、网页、图片、视频或其他媒体资源。
250 1
|
存储 Android开发
解读ImageView的wrap_content和adjustViewBounds的工作原理
ImageView是android开发过程中经常会使用的一种组件,由于android屏幕碎片化的问题,有时候我们无法设定一个具体的宽高。比如说width是match_parent的,这时候我们还想让图片在宽度完全填充并能正常显示,我们直接会想到将height设置为wrap_content。但是用过的同学都知道ImageView的实际区域要大于图片区域
299 0
|
JSON JavaScript API
axios设置content-type
axios设置content-type
877 0
|
XML JSON JavaScript
二、HTTP Content-Type详解
二、HTTP Content-Type详解
272 1
the content is displayed over another view controller’s content
the content is displayed over another view controller’s content
112 0
the content is displayed over another view controller’s content
data-sap-ui-icon-content where does icon content come from
Created by Wang, Jerry, last modified on Feb 11, 2015
data-sap-ui-icon-content where does icon content come from
|
XML 数据格式 前端开发