Im curious the best what to handle an HTML table with the if:else conditional.
I’m using the Grid, with 17 elements.
I’m outputting this into an HTML table, but I need to some how run an if:else on it all. The products in the grid could be in the hundreds, however, there may be only 5-6 elements used at a time? make sense?
Here is my code.
{exp:channel:entries channel="myproducts" disable="pagination"}
<table>
<thead>
<tr>
<th>Item Number</th>
<th>Size</th>
<th>Thickness</th>
<th>Weight</th>
<th>Quantity</th>
{product_details}{if ...}<th>Color</th>{/if}{/product_details}
<th>yuioyui</th>
<th>yuioyui</th>
<th>yuioyu</th>
<th>dfgbfg</th>
<th>ertg</th>
<th>ghkui</th>
<th>ghnfgh</th>
<th>assgtn</th>
<th>asdf vbn</th>
<th>asdfasdf</th>
<th>asdf</th>
</tr>
</thead>
<tbody>{product_details}
<tr>
<td>{product_details:item_no}</td>
<td>{product_details:size}</td>
<td>{product_details:thickness}</td>
<td>{product_details:weight}</td>
<td>{product_details:quantity}</td>
<td>{product_details:color}</td>
<td>Content Goes Here</td>
<td>Content Goes Here</td>
<td>Content Goes Here</td>
<td>Content Goes Here</td>
<td>Content Goes Here</td>
<td>Content Goes Here</td>
<td>Content Goes Here</td>
<td>Content Goes Here</td>
<td>Content Goes Here</td>
<td>Content Goes Here</td>
<td>Content Goes Here</td>
</tr>{/product_details}
</tbody>
</table>
{/exp:channel:entries}This would require an if statement on every row… i dont think that is right. and I cant move the “product_details” tag out.
The only element that is standard across all entries is the item number. Everything else is is different depending on the product…. however, not every element will be used. maybe 5-6 at most.
Or is this not the way do even do this?
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.