Система управления «Сайт PRO»
Версия 20240107

block.2col.php

Блок «2 колонки»

Вызывается из:

Исходный код
<?php

$children = $block['children'];

$classNames = array('uk-grid', 'uk-child-width');
if ($block['data']['grid-options']) foreach (is_array($block['data']['grid-options']) ? $block['data']['grid-options'] : explode('|', $block['data']['grid-options']) as $option) if ($option) {
    if (substr($option, 0, 3) === 'uk-') $classNames[] = $option;
}
print '<div class="' . implode(' ', $classNames) . '">';

$classNames = array('uk-first-column uk-grid-margin');
if ($block['data']['col1-options']) foreach (is_array($block['data']['col1-options']) ? $block['data']['col1-options'] : explode('|', $block['data']['col1-options']) as $option) if ($option) {
    if (substr($option, 0, 3) === 'uk-') $classNames[] = $option;
}
print '<div class="' . implode(' ', $classNames) . '">';
print $block['html1'];
if (is_array($block['children1'])) foreach ($block['children1'] as $child) print $child['html'];
if (is_array($children)) if ($child = array_shift($children)) print $child['html'];
print '</div>';

$classNames = array('uk-grid-margin');
if ($block['data']['col2-options']) foreach (is_array($block['data']['col2-options']) ? $block['data']['col2-options'] : explode('|', $block['data']['col2-options']) as $option) if ($option) {
    if (substr($option, 0, 3) === 'uk-') $classNames[] = $option;
}
print '<div class="' . implode(' ', $classNames) . '">';
print $block['html2'];
if (is_array($block['children2'])) foreach ($block['children2'] as $child) if (is_array($child)) print $child['html'];
if (is_array($children)) if ($child = array_shift($children)) print $child['html'];
print '</div>';

if (is_array($children)) while ($child = array_shift($children)) {
    print '<div class="' . implode(' ', $classNames) . '">';
    print $child['html'];
    print '</div>';
}

print '</div>';

if (is_array($children)) return;

$html = ob_get_clean();

ob_start();

print $Main->callTemplate('block/block', 'block', $Page, array( 'block' => $block, 'html' => $html ));

?>