$diydata = C::t('common_diy_data')->fetch($tplname, $tpldirectory); if (empty($diydata) && $id) { $diydata = C::t('common_diy_data')->fetch($tpl, $tpldirectory); } if ($diydata) { $filename = $diydata['targettplname']; $diycontent = dunserialize($diydata['diycontent']); if (empty($diycontent)) { showmessage('diy_no_export_data'); } if ($frame) { $area = ''; $filename = $frame; $framedata = array(); foreach ($diycontent['layoutdata'] as $key => $value) { $framedata = getobjbyname($frame, $value); if ($framedata) { $area = $key; getframeblock(array($framedata['type'] . '`' . $frame => $framedata['content'])); break; } } } else { foreach ($diycontent['layoutdata'] as $key => $value) { if (!empty($value)) { getframeblock($value); } } } $diycontent['blockdata'] = block_export($_G['curtplbid']); if ($frame) {
function getobjbyname($name, $data) { if (!$name || !$data) { return false; } foreach ((array) $data as $id => $content) { list($type, $curname) = explode('`', $id); if ($curname == $name) { return array('type' => $type, 'content' => $content); } elseif ($type == 'frame' || $type == 'tab' || $type == 'column') { $r = getobjbyname($name, $content); if ($r) { return $r; } } } return false; }