Exemplo n.º 1
0
function module_advert_edit()
{
    global $global, $smarty;
    $obj = new advert();
    $obj->set_where('adv_id = ' . $global['id']);
    $smarty->assign('advert', $obj->get_one());
}
Exemplo n.º 2
0
function module_ad($par)
{
    global $smarty;
    $obj = new advert();
    $obj->set_where('adv_id = ' . $par['id']);
    $one = $obj->get_one();
    $ad = '';
    if (count($one)) {
        $ad = str_replace(''', chr(39), $one['adv_code']);
    }
    $smarty->assign('ad', $ad);
}
Exemplo n.º 3
0
function add_or_edit_advert()
{
    global $smarty, $lang;
    $adv_id = post('adv_id');
    $adv_name = post('adv_name');
    $adv_code = post('adv_code', 'loose');
    $obj = new advert();
    $obj->set_value('adv_name', $adv_name);
    $obj->set_value('adv_code', $adv_code);
    if ($adv_id != '') {
        $obj->set_where("adv_id = {$adv_id}");
        $obj->edit();
        $info_text = '修改广告成功';
    } else {
        $obj->add();
        $info_text = '添加广告成功';
    }
    $smarty->assign('info_text', $info_text);
    $smarty->assign('link_text', $lang['return_list']);
    $smarty->assign('link_href', url(array('channel' => 'basic', 'mod' => 'advert_list')));
}