开发者

question about application.html.erb

i have a table in my application.html.erb.like this:

<body>
<table width='100%' border='3'>
  <tr><td height="100"> </td></tr>
  <tr>
    <td width="10%"></td>
    <td width="80%"></td>
    <td width="10%"></td>
  </tr>
</table>

<%= yield %>

</body>

i want to put contents of other page in <td width="80%"&开发者_Python百科gt;</td> but i dont know how can i do that? thank you for your helps


<body>
<table width='100%' border='3'>
  <tr><td height="100"> </td></tr>
  <tr>
    <td width="10%"></td>
    <td width="80%"><%= render "other_page" %></td>
    <td width="10%"></td>
  </tr>
</table>

<%= yield %>

</body>

This will render _other_page.html.erb.

Read more about it here: http://guides.rubyonrails.org/layouts_and_rendering.html#using-partials


Simply move the yield statement:

<body>
  <table width='100%' border='3'>
    <tr>
      <td height="100"></td>
    </tr>
    <tr>
      <td width="10%"></td>
      <td width="80%"><%= yield %></td>
      <td width="10%"></td>
    </tr>
  </table>
</body>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜