新手问题 Rails 模板中如何处理标题?

kenneth · June 24, 2012 · Last by kenneth replied at June 24, 2012 · 3725 hits

模板页和详细页中如何处理标题 title? 定义在 layout/application.html.erb 中?应该如何处理?

<%= @page_title ? "#{t('site.name')} - #{@page_title.to_s}" : t('site.name') %>

toturial 上是这样的 application.html.erb

<%=yield :title%>

然后具体页 <%provide(:title,"your title")%>

谢谢大家的建议我用 content_for 实现了,http://www.appfp.com

You need to Sign in before reply, if you don't have an account, please Sign up first.