function module_comment_sheet() { global $global, $smarty; $obj = new comment(); $obj->set_page_size(10); $obj->set_page_num($global['page']); $sheet = $obj->get_sheet(); set_link($obj->get_page_sum()); for ($i = 0; $i < count($sheet); $i++) { $sheet[$i]['channel'] = ''; $sheet[$i]['title'] = ''; $obj = new channel(); $list = $obj->get_list(); for ($j = 0; $j < count($list); $j++) { if ($list[$j]['cha_id'] == $sheet[$i]['com_channel_id']) { $sheet[$i]['channel'] = $list[$j]['cha_code']; $original = $list[$j]['cha_code']; if ($list[$j]['cha_original'] != 0) { for ($k = 0; $k < count($list); $k++) { if ($list[$j]['cha_original'] == $list[$k]['cha_id']) { $original = $list[$k]['cha_code']; } } } if ($original == 'goods') { $table = 'goods'; } else { $table = 'article'; } $sheet[$i]['title'] = get_data($table, $sheet[$i]['com_page_id'], substr($table, 0, 3) . '_title'); } } } $smarty->assign('comment', $sheet); }
function module_sheet() { global $global, $smarty; $prefix = $global['channel'] . '/mod-sheet'; if (isset($global['field'])) { $prefix = $prefix . '/field-' . $global['field']; } if (isset($global['key'])) { $prefix = $prefix . '/key-' . $global['key']; } $obj = new article(); $obj->set_where('art_channel_id = ' . $global['channel_id']); if (isset($global['key'])) { $obj->set_where($global['field'] . " like '%" . url_decode($global['key']) . "%'"); } $obj->set_page_size(10); $obj->set_page_num($global['page']); $sheet = $obj->get_sheet(); for ($i = 0; $i < count($sheet); $i++) { $sheet[$i]['cat_name'] = get_data('cat_art', $sheet[$i]['art_cat_id'], 'cat_name'); } set_link($obj->get_page_sum()); $smarty->assign('article', $sheet); $smarty->assign('prefix', $prefix); }
function module_message_main() { global $global, $smarty; $obj = new message(); $obj->set_page_size(5); $obj->set_page_num($global['page']); $sheet = $obj->get_sheet(); set_link($obj->get_page_sum()); $smarty->assign('message', $sheet); }
function module_comment() { global $global, $smarty; if ($global['id']) { $obj = new comment(); $obj->set_where('com_channel_id = ' . get_id('channel', 'cha_code', $global['channel'])); $obj->set_where('com_page_id = ' . $global['id']); $obj->set_page_size(5); $obj->set_page_num($global['page']); $sheet = $obj->get_sheet(); set_link($obj->get_page_sum()); $smarty->assign('comment', $sheet); } }
function module_search_main() { global $global, $smarty; $global['key'] = url_decode($global['key']); $list_len = get_varia('art_list_len'); $obj = new article(); $obj->set_field('art_id,art_channel_id,art_title,art_add_time'); $obj->set_where("art_title like '%" . $global['key'] . "%'"); $obj->set_page_size($list_len ? $list_len : 20); $obj->set_page_num($global['page']); $sheet = $obj->get_sheet(); for ($i = 0; $i < count($sheet); $i++) { $sheet[$i]['channel'] = get_data('channel', $sheet[$i]['art_channel_id'], 'cha_code'); $sheet[$i]['short_title'] = cut_str($sheet[$i]['art_title'], 42); } set_link($obj->get_page_sum()); $smarty->assign('search', $sheet); }
function module_article_main() { global $global, $smarty; if (!$global['id']) { $art_best = get_global('best'); $prefix = get_data('channel', $global['channel_id'], 'cha_code'); $list_len = get_varia('art_list_len'); $obj = new article(); $obj->set_where('art_channel_id = ' . $global['channel_id']); if ($global['cat']) { $family = implode(',', get_cat_family('cat_art', $global['cat'])); $obj->set_where("art_cat_id in ({$family})"); $prefix .= '/cat-' . $global['cat']; } if ($art_best) { $obj->set_where('art_best = 1'); $prefix .= '/best-1'; } $obj->set_page_size($list_len ? $list_len : 20); $obj->set_page_num($global['page']); $sheet = $obj->get_sheet(); for ($i = 0; $i < count($sheet); $i++) { $sheet[$i]['short_title'] = cut_str($sheet[$i]['art_title'], 42); } set_link($obj->get_page_sum()); $smarty->assign('show_sheet', 1); $smarty->assign('article', $sheet); $smarty->assign('prefix', $prefix); } else { $obj = new article(); $obj->set_field('art_id,art_title,art_author,art_add_time,art_text'); $obj->set_where('art_channel_id = ' . $global['channel_id']); $obj->set_where('art_id = ' . $global['id']); $one = $obj->get_one(); $smarty->assign('article', $one); $obj = new article(); $obj->set_field('art_id,art_title'); $obj->set_where('art_channel_id = ' . $global['channel_id']); $obj->set_where('art_id < ' . $global['id']); $one = $obj->get_one(); if (count($one)) { $smarty->assign('next_id', $one['art_id']); $smarty->assign('next_title', cut_str($one['art_title'], 15)); } else { $smarty->assign('next_id', ''); $smarty->assign('next_title', ''); } $obj = new article(); $obj->set_field('art_id,art_title'); $obj->set_where('art_channel_id = ' . $global['channel_id']); $obj->set_where('art_id > ' . $global['id']); $obj->set_order(''); $obj->set_order('art_top', 'asc'); $obj->set_order('art_index', 'asc'); $obj->set_order('art_id', 'asc'); $one = $obj->get_one(); if (count($one)) { $smarty->assign('prev_id', $one['art_id']); $smarty->assign('prev_title', cut_str($one['art_title'], 15)); } else { $smarty->assign('prev_id', ''); $smarty->assign('prev_title', ''); } $obj = new varia(); $smarty->assign('share_code', im_filter($obj->get_value('share_code', true))); $smarty->assign('show_sheet', 0); } }