array( 'title' => 'adv_adv', 'type' => 'mradio', 'value' => array(), ), 'title' => array( 'title' => 'adv_title', 'type' => 'text', ) ); foreach(C::t('common_advertisement_custom')->fetch_all_data() as $value) { $settings['adv']['value'][] = array($value['name'], $value['name']); } return $settings; } function getdata($style, $parameter) { $advid = 0; if(!empty($parameter['title'])) { $adv = C::t('common_advertisement_custom')->fetch_by_name($parameter['title']); if(empty($adv)) { $advid = C::t('common_advertisement_custom')->insert(array('name' => $parameter['title']), true); } else { $advid = $adv['id']; } } elseif(!empty($parameter['adv'])) { $adv = C::t('common_advertisement_custom')->fetch_by_name($parameter['adv']); $advid = intval($adv['id']); } else { $return = 'Empty Ads'; } if($advid) { $flag = false; if(getglobal('inajax')) { $flag = true; setglobal('inajax', 0); } $return = adshow('custom_'.$advid); if($flag) setglobal('inajax', 1); } return array('html' => $return, 'data' => null); } } ?>