Часть кода |explode:","
, представленная ниже, кажется, не работает, а foreach $widgets_ids
только зацикливается один раз. Я попытался добавить {$widgets_ids}
для отладки, и это отображает Array
, поэтому он наполовину работает.
{foreach $layout_containers.rows as $row}
<td class="layout_container" data-cid="{$row.container_id.fvalue}">
Container: <strong>{$row.container_key.fvalue}</strong>
<br />
<a class="btnMed" rel="rename_container" href="javascript:;">Rename</a>
<a class="btnMed" rel="delete_container" href="javascript:;">Delete</a>
{if $row.widgets_ids.value}
{assign var="widgets_ids" value=$row.widgets_ids.fvalue|explode:","}
{foreach $widgets_ids as $widgets_id}
{assign var="widget" value=$widgets.rows[$widgets_id]}
<div data-widget="{$widget.id.fvalue}" class="widget ui-draggable">
<img align="middle" src="{$HOME}{$TEMPLATE_HOME}/admin/images/icons/drag_drop.png" alt="{$widget.name.fvalue}" />
{$widget.name.fvalue}
</div>
{/foreach}
{/if}
{* droparea widget *}
<div class="drop_area">drop area</div>
</td>
{/foreach}
Выходной массив отправляется на страницу:
[widgets] => Array
(
[type] => Table
[rowcount] => 5
[name] => widgets
[rows] => Array
(
[0] => Array
(
[id] => Array
(
[name] => widgets.widget_id
[value] => 1
[fvalue] => 1
)
[name] => Array
(
[name] => widgets.widget_name
[value] => Featured
[fvalue] => Featured
)
[fixed] => Array
(
[name] => widgets.widget_fixed
[value] => 0
[fvalue] => 0
)
[title] => Array
(
[name] => widgets.widget_title
[value] => We recommend these bookmakers
[fvalue] => We recommend these bookmakers
)
[description] => Array
(
[name] => widgets.widget_description
[value] =>
[fvalue] =>
)
[image] => Array
(
[name] => widgets.widget_image
[value] =>
[fvalue] =>
)
[status] => Array
(
[name] => widgets.widget_status
[value] => ENABLED
[fvalue] => Enabled
)
[template] => Array
(
[name] => widgets.widget_template
[value] => widgets/featured.tpl
[fvalue] => widgets/featured.tpl
)
)
[1] => Array
(
[id] => Array
(
[name] => widgets.widget_id
[value] => 2
[fvalue] => 2
)
[name] => Array
(
[name] => widgets.widget_name
[value] => Tips
[fvalue] => Tips
)
[fixed] => Array
(
[name] => widgets.widget_fixed
[value] => 0
[fvalue] => 0
)
[title] => Array
(
[name] => widgets.widget_title
[value] => Betting Tips
[fvalue] => Betting Tips
)
[description] => Array
(
[name] => widgets.widget_description
[value] =>
[fvalue] =>
)
[image] => Array
(
[name] => widgets.widget_image
[value] =>
[fvalue] =>
)
[status] => Array
(
[name] => widgets.widget_status
[value] => ENABLED
[fvalue] => Enabled
)
[template] => Array
(
[name] => widgets.widget_template
[value] => widgets/tips.tpl
[fvalue] => widgets/tips.tpl
)
)
[2] => Array
(
[id] => Array
(
[name] => widgets.widget_id
[value] => 3
[fvalue] => 3
)
[name] => Array
(
[name] => widgets.widget_name
[value] => Casion
[fvalue] => Casion
)
[fixed] => Array
(
[name] => widgets.widget_fixed
[value] => 0
[fvalue] => 0
)
[title] => Array
(
[name] => widgets.widget_title
[value] => Casion
[fvalue] => Casion
)
[description] => Array
(
[name] => widgets.widget_description
[value] => <p>Best slot & Live casino £75 welcome bonus!</p>
[fvalue] => <p>Best slot & Live casino £75 welcome bonus!</p>
)
[image] => Array
(
[name] => widgets.widget_image
[value] => /widgets/4f4ceb235bb9a_banner-casino.png
[fvalue] => /widgets/4f4ceb235bb9a_banner-casino.png
)
[status] => Array
(
[name] => widgets.widget_status
[value] => ENABLED
[fvalue] => Enabled
)
[template] => Array
(
[name] => widgets.widget_template
[value] => widgets/banner.tpl
[fvalue] => widgets/banner.tpl
)
)
[3] => Array
(
[id] => Array
(
[name] => widgets.widget_id
[value] => 4
[fvalue] => 4
)
[name] => Array
(
[name] => widgets.widget_name
[value] => Football
[fvalue] => Football
)
[fixed] => Array
(
[name] => widgets.widget_fixed
[value] => 0
[fvalue] => 0
)
[title] => Array
(
[name] => widgets.widget_title
[value] => Football
[fvalue] => Football
)
[description] => Array
(
[name] => widgets.widget_description
[value] => <p>Bet now & wind a real football ball!</p>
[fvalue] => <p>Bet now & wind a real football ball!</p>
)
[image] => Array
(
[name] => widgets.widget_image
[value] => /widgets/4f4ceb44a7072_banner-football.png
[fvalue] => /widgets/4f4ceb44a7072_banner-football.png
)
[status] => Array
(
[name] => widgets.widget_status
[value] => ENABLED
[fvalue] => Enabled
)
[template] => Array
(
[name] => widgets.widget_template
[value] => widgets/banner.tpl
[fvalue] => widgets/banner.tpl
)
)
[4] => Array
(
[id] => Array
(
[name] => widgets.widget_id
[value] => 5
[fvalue] => 5
)
[name] => Array
(
[name] => widgets.widget_name
[value] => Horses
[fvalue] => Horses
)
[fixed] => Array
(
[name] => widgets.widget_fixed
[value] => 0
[fvalue] => 0
)
[title] => Array
(
[name] => widgets.widget_title
[value] => Horses
[fvalue] => Horses
)
[description] => Array
(
[name] => widgets.widget_description
[value] => <p>Bet now & win borse statue!</p>
[fvalue] => <p>Bet now & win borse statue!</p>
)
[image] => Array
(
[name] => widgets.widget_image
[value] => /widgets/4f4ceb66381ab_banner-horses.png
[fvalue] => /widgets/4f4ceb66381ab_banner-horses.png
)
[status] => Array
(
[name] => widgets.widget_status
[value] => ENABLED
[fvalue] => Enabled
)
[template] => Array
(
[name] => widgets.widget_template
[value] => widgets/banner.tpl
[fvalue] => widgets/banner.tpl
)
)
)
)
Layout_containers
[layout_containers] => Array
(
[type] => Table
[rowcount] => 3
[name] => layout_containers
[header] => Array
(
[names] => Array
(
[0] => container_id
[1] => id
[2] => container_key
[3] => container_title
[4] => widgets_ids
)
[container_id] => Array
(
[enabled] => 0
[sort] => ASC
[nextsort] => DESC
[name] => layout_containers.layout_container_id
[label] => Container Id
[url] => /gambler_compendium/admin/layout/widgets/id/1/layout_containers.layout_containers.layout_container_id/desc
[formname] => layout_containers.layout_containers.layout_container_id
[hidden] =>
)
[id] => Array
(
[enabled] => 0
[sort] => ASC
[nextsort] => DESC
[name] => layout_containers.layout_id
[label] => Id
[url] => /gambler_compendium/admin/layout/widgets/id/1/layout_containers.layout_containers.layout_id/desc
[formname] => layout_containers.layout_containers.layout_id
[hidden] =>
)
[container_key] => Array
(
[enabled] => 1
[sort] => ASC
[nextsort] => DESC
[name] => layout_containers.layout_container_key
[label] => Container Key
[url] => /gambler_compendium/admin/layout/widgets/id/1/layout_containers.layout_containers.layout_container_key/desc
[formname] => layout_containers.layout_containers.layout_container_key
[hidden] =>
)
[container_title] => Array
(
[enabled] => 0
[sort] => ASC
[nextsort] => DESC
[name] => layout_containers.layout_container_title
[label] => Container Title
[url] => /gambler_compendium/admin/layout/widgets/id/1/layout_containers.layout_containers.layout_container_title/desc
[formname] => layout_containers.layout_containers.layout_container_title
[hidden] =>
)
[widgets_ids] => Array
(
[enabled] => 0
[sort] => ASC
[nextsort] => DESC
[name] => layout_containers.widgets_ids
[label] => Widgets Ids
[url] => /gambler_compendium/admin/layout/widgets/id/1/layout_containers.layout_containers.widgets_ids/desc
[formname] => layout_containers.layout_containers.widgets_ids
[hidden] =>
)
)
[field] => Array
(
[names] => Array
(
)
)
[rows] => Array
(
[0] => Array
(
[container_id] => Array
(
[name] => layout_containers.layout_container_id
[value] => 113
[fvalue] => 113
)
[id] => Array
(
[name] => layout_containers.layout_id
[value] => 1
[fvalue] => 1
)
[container_key] => Array
(
[name] => layout_containers.layout_container_key
[value] => sidebarLeft
[fvalue] => sidebarLeft
)
[container_title] => Array
(
[name] => layout_containers.layout_container_title
[value] =>
[fvalue] =>
)
[widgets_ids] => Array
(
[name] => layout_containers.widgets_ids
[value] => 1,2
[fvalue] => 1,2
)
)
[1] => Array
(
[container_id] => Array
(
[name] => layout_containers.layout_container_id
[value] => 115
[fvalue] => 115
)
[id] => Array
(
[name] => layout_containers.layout_id
[value] => 1
[fvalue] => 1
)
[container_key] => Array
(
[name] => layout_containers.layout_container_key
[value] => sidebarRight_banners
[fvalue] => sidebarRight_banners
)
[container_title] => Array
(
[name] => layout_containers.layout_container_title
[value] =>
[fvalue] =>
)
[widgets_ids] => Array
(
[name] => layout_containers.widgets_ids
[value] => 3,4,5
[fvalue] => 3,4,5
)
)
[2] => Array
(
[container_id] => Array
(
[name] => layout_containers.layout_container_id
[value] => 114
[fvalue] => 114
)
[id] => Array
(
[name] => layout_containers.layout_id
[value] => 1
[fvalue] => 1
)
[container_key] => Array
(
[name] => layout_containers.layout_container_key
[value] => sidebarRight_bannersList
[fvalue] => sidebarRight_bannersList
)
[container_title] => Array
(
[name] => layout_containers.layout_container_title
[value] =>
[fvalue] =>
)
[widgets_ids] => Array
(
[name] => layout_containers.widgets_ids
[value] =>
[fvalue] =>
)
)
)
)