Too many {foreach} workaround?

31written posts
Lorsynthearned bits
offlinecurrently
Lorsynth
New Member
Lorsynth Avatar
"Hail. Praise"
It wont let me save a template because there are too many foreach loops, is there a way around this or to extend this? This is how my coding is set up, I have roughly 30 custom fields, the second lot of code is my attempt at trying to reduce foreachs but it made everything go haywire.



<td><div style="margin-top:4px;width: 80px; height: 18px; overflow: auto; padding: 4px; border: solid 2px #000000; background-color: #393c4d;">{foreach $[post.created_by.custom_field]}



       {if $[post.created_by.custom_field.name] == "First Race"}$[post.created_by.custom_field.value]



{/if}{/foreach}</div></td>



<td><div style="margin-left:13px;margin-top:4px;width: 59px; height: 18px; overflow: auto; padding: 4px; border: solid 2px #000000; background-color: #393c4d;">{foreach $[post.created_by.custom_field]}



       {if $[post.created_by.custom_field.name] == "First Gender"}$[post.created_by.custom_field.value]



{/if}{/foreach}</div></td>



<td><div style="margin-left:6px;margin-top:4px;width: 30px; height: 18px; overflow: auto; padding: 4px; border: solid 2px #000000; background-color: #393c4d;">{foreach $[post.created_by.custom_field]}



       {if $[post.created_by.custom_field.name] == "First Age"}$[post.created_by.custom_field.value]



{/if}{/foreach}</div></td>



<td><div style="margin-left:-31px;margin-top:4px;width: 102px; height: 18px; overflow: auto; padding: 4px; border: solid 2px #000000; background-color: #393c4d;">{foreach $[post.created_by.custom_field]}



       {if $[post.created_by.custom_field.name] == "First Profession"}$[post.created_by.custom_field.value]



{/if}{/foreach}</div></td>


<td>{foreach $[post.created_by.custom_field]}<div style="margin-top:4px;width: 80px; height: 18px; overflow: auto; padding: 4px; border: solid 2px #000000; background-color: #393c4d;">



       {if $[post.created_by.custom_field.name] == "First Race"}$[post.created_by.custom_field.value]{/if}



</div></td>



<td><div style="margin-left:13px;margin-top:4px;width: 59px; height: 18px; overflow: auto; padding: 4px; border: solid 2px #000000; background-color: #393c4d;">



       {if $[post.created_by.custom_field.name] == "First Gender"}$[post.created_by.custom_field.value]{/if}



</div></td>



<td><div style="margin-left:6px;margin-top:4px;width: 30px; height: 18px; overflow: auto; padding: 4px; border: solid 2px #000000; background-color: #393c4d;">



       {if $[post.created_by.custom_field.name] == "First Age"}$[post.created_by.custom_field.value]{/if}



</div></td>



<td><div style="margin-left:-31px;margin-top:4px;width: 102px; height: 18px; overflow: auto; padding: 4px; border: solid 2px #000000; background-color: #393c4d;">



       {if $[post.created_by.custom_field.name] == "First Profession"}$[post.created_by.custom_field.value]{/if}



{/if}</div>{/foreach}</td>


3,084written posts
Kitten4uearned bits
offlinecurrently
Kitten4u
Part of the Furniture
Kitten4u Avatar
[nospaces]

[attr="class","infoBG"]
[attr="class","infoBG2"]
[attr="class","infoBack"]
[attr="class","infoTitle"][attr="class","fa fa-star-o"] threadarchived
[attr="class","infoDiv"]

[attr="class","infoBody"]

To keep the forum clean and so people know that all threads in certain areas are current and that the OP is likely to still have interest, we archive threads that haven't gotten posts for 2 weeks. This thread is being archived for that reason. If you would like this thread reopened, contact a staff member.