0

我正在调整我收到的模板,该模板基本上是一个待售产品列表。我想将它从自上而下的列表更改为表格布局。我想最终得到如下结果-

<div id= 'ladiesproducts'>
<% ladies_products = hosting_products.find_all do
|product|
product.name.match("ladies")
end %>
<table><tbody>
<% [ladies_products].each do | slice | %>
<tr>
<% slice.each do | product | %>
<td>
<h4><%= product.name.html %></h4>
<p><%= product.description %></p>
<% other parts go here %>
</td>
<% end %>
</tr>
<% end %>
</tbody></table>
</div>

这适用于我想要实现的布局。我遇到的问题是当我粘贴回 <% other parts go here %> 部分代码时。我在页面上收到内部错误消息。我对 Ruby 完全陌生,所以我真的只是在摸索。我有一种预感,我忽略了一些可能非常简单的事情。<% other parts go here %>代码如下:

<input type='hidden' name='base_renewal_period-<%= i %>' value="<%= 
product.base_renewal_period %>" />
<input type='hidden' name='quoted_unit_price-<%= i %>' value="<%=         billing.price(product.unit_price) 
%>" />
<p><input type='radio' name='add-product' value='<%= product.specific_type.html %>:<%= i 
%>:base_renewal_period,quoted_unit_price,domain' /><%= billing.currency_symbol.html %><%= 
billing.price(product.unit_price, :use_tax_prefs) %>
<% if product.base_renewal_period != 'never' %>
every <%= product.unit_period.to_s_short.html %>
<% end %>
<% if product.setup_fee != 0 %>
plus a one off fee of <%= billing.currency_symbol.html %><%= sprintf("%.2f", if billing.include_tax? 
then billing.price(product.setup_fee) else product.setup_fee end) %>
<% end %>
<% if product.has_free_products? %>
<br />
includes free domains 
<% product.free_products_list.each do | free_product | %>
<%= free_product["free_name"] %>
<% end %>
<% end %>
*
</p>
<% i = i + 1 %>
<% end %>
<p><input type='submit' value='Add to Basket'/></p>
</form>
<% unless basket.nil? or basket.empty? or no_upsell? %>
<p><a href='basket?add-no-product=package'>No thank you, please continue with my order 
...</a></p>
<% end %>
<% if not billing.tax_applies? %>
<% elsif billing.include_tax? %>
<p>* Includes <%= billing.tax_name %></p>
<% else %>
<p>* Excluding <%= billing.tax_name %></p>
<% end %>

如果有人能指出我做错了什么,或者我错过了什么或未能改变,我将不胜感激!提前谢谢了。奈杰尔

4

1 回答 1

0

看来你end在你身边的另一半i = i + 1有着无与伦比的存在。

于 2010-05-29T20:11:18.987 回答