User Defined Limit - Assign Variable From Form?
Design and Skin Customization
douglas:
This might work as long as $item._profile_id is available in the template where your jrCore_list call is located.
If I am understanding correctly, that would be my item_list.tpl and $item._profile_id is already in use there, so it probally will work.
However, there is already a foreach statement running there. So I'm a little confused about where to add this one, outside or inside of the other.
So currently it looks like this with the other content categories removed for simplicity.
{jrCore_module_url module="xxSales" assign="murl"}
{if isset($_items)}
{foreach from=$_items item="item"}
<div class="item">
<div class="block_config">
{jrCore_item_list_buttons module="xxSales" item=$item}
</div>
{if strlen($item.sales_editor) > 0}
{$item.sales_editor|jrCore_format_string:$item.profile_quota_id}
{/if}
{* Other Categories Removed But Function Like Video *}
{* Video *}
{if $item.sales_videos == 'on'}
<div class="title">
<h1>Video</h1> <input type="button" value="View All" class="form_button" style="float: right;" onclick="jrCore_window_location('{$jamroom_url}/{$_post.module_url}/uploaded_video');">
<div class="block_content">
{jrCore_list module="jrVideo" profile_id=$item._profile_id search1="video_file_item_price > 0" order_by="video_display_order numerical_asc" limit="2"}
</div>
</div>
{/if}
<br>
</div>
{/foreach}
{/if}
So should the capture/assign with IT'S OWN foreach statement run within the EXISTING foreach statement like this:
{jrCore_module_url module="xxSales" assign="murl"}
{if isset($_items)}
{foreach from=$_items item="item"}
<div class="item">
<div class="block_config">
{jrCore_item_list_buttons module="xxSales" item=$item}
</div>
{if strlen($item.sales_editor) > 0}
{$item.sales_editor|jrCore_format_string:$item.profile_quota_id}
{/if}
{capture name="limit_template" assign="limit_template_row"}
{literal}
{if isset($_items)}
{foreach $_items as $item}
{$item.sales_videos_limit}
{/foreach}
{/if}
{/literal}
{/capture}
{jrCore_list module="jrVideo" profile_id=$item._profile_id limit="1" template=$limit_template_row assign="svl"}
{* Other Categories Removed But Function Like Video *}
{* Video *}
{if $item.sales_videos == 'on'}
<div class="title">
<h1>Video</h1> <input type="button" value="View All" class="form_button" style="float: right;" onclick="jrCore_window_location('{$jamroom_url}/{$_post.module_url}/uploaded_video');">
<div class="block_content">
{if isset($svl) && $svl > 0}
{jrCore_list module="jrVideo" profile_id=$item._profile_id search1="video_file_item_price > 0" order_by="video_display_order numerical_asc" limit=$svl}
{else}
{jrCore_list module="jrVideo" profile_id=$item._profile_id search1="video_file_item_price > 0" order_by="video_display_order numerical_asc" limit="2"}
</div>
</div>
{/if}
<br>
</div>
{/foreach}
{/if}
Then would I just repeat the process for all my other categories (substituting names) such that I end up with half a dozen foreach statements inside a foreach statement - or would the server melt????
Or is the proper way to have only the existing foreach statement and add all the capture/assigns to it. If so, what would that look like? Perhaps something like this for the video example?
{capture name="limit_template" assign="limit_template_row"}{$item.sales_videos_limit}{/capture}
{jrCore_list module="jrVideo" profile_id=$item._profile_id limit="1" template=$limit_template_row assign="svl"}
updated by @ken-rich: 04/27/16 01:50:22PM