function getBrowseBlock($sContent, $iUnitWidth, $iUnitCount, $iWishWidth = 0) { $iAllWidth = $iWishWidth > 0 ? $iWishWidth : (int) getParam('main_div_width'); $iDestWidth = getBlockWidth($iAllWidth, $iUnitWidth, $iUnitCount); $aUnit = array('content' => $sContent, 'bx_if:dest_width' => array('condition' => $iDestWidth > 0, 'content' => array('width' => $iDestWidth))); return $this->parseHtmlByName('centered_block.html', $aUnit); }
function GenFormWrap($sMainContent, $sPage, $sFunctionName, $iMaxThumbWidth, $iThumbsCnt) { $sBlockWidthSQL = "SELECT `PageWidth`, `ColWidth` FROM `sys_page_compose` WHERE `Page`='{$sPage}' AND (`Func`='{$sFunctionName}' OR `Caption`='{$sFunctionName}')"; $aBlockWidthInfo = db_arr($sBlockWidthSQL); $aBlockWidth = (int) ((int) ($aBlockWidthInfo['PageWidth'] - 20) * (int) $aBlockWidthInfo['ColWidth'] / 100) - 14; $iDestWidth = $iThumbsCnt * $iMaxThumbWidth; $iDestWidth = getBlockWidth($aBlockWidth, $iMaxThumbWidth, $iThumbsCnt); $sWidthCent = $iDestWidth > 0 ? "width:{$iDestWidth}px;" : ''; return <<<EOF <div class="block_rel_100 bx-def-bc-margin"> <div class="centered_div" style="{$sWidthCent}"> {$sMainContent} </div> <div class="clear_both"></div> </div> EOF; }