本文整理汇总了PHP中article::set_where方法的典型用法代码示例。如果您正苦于以下问题:PHP article::set_where方法的具体用法?PHP article::set_where怎么用?PHP article::set_where使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类article
的用法示例。
在下文中一共展示了article::set_where方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: module_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);
}
示例2: module_article_list
function module_article_list()
{
global $smarty;
$obj = new cat_art();
$obj->set_where('cat_best = 1');
$best_cat = $obj->get_list();
$art_list = array();
if (count($best_cat) > 0) {
$smarty->assign('show_all_art', 0);
$list_len = get_varia('index_art_list_len');
for ($i = 0; $i < count($best_cat); $i++) {
$cat_id = $best_cat[$i]['cat_id'];
$best_cat[$i]['channel'] = get_data('channel', $best_cat[$i]['cat_channel_id'], 'cha_code');
$family = implode(',', get_cat_family('cat_art', $cat_id));
$obj = new article();
$obj->set_field('art_id,art_title,art_add_time');
$obj->set_where("art_cat_id in ({$family})");
$obj->set_page_size($list_len ? $list_len : 5);
$list = $obj->get_list();
for ($j = 0; $j < count($list); $j++) {
$list[$j]['short_title'] = cut_str($list[$j]['art_title'], 22);
}
$art_list[$cat_id] = $list;
unset($obj);
}
$smarty->assign('best_art_cat', $best_cat);
$smarty->assign('art_list', $art_list);
} else {
$smarty->assign('show_all_art', 1);
}
}
示例3: module_best_article
function module_best_article()
{
global $smarty;
$obj = new article();
$obj->set_field('art_id,art_channel_id,art_title,art_add_time');
$obj->set_where('art_best = 1');
$obj->set_page_size(10);
$list = $obj->get_list();
for ($i = 0; $i < count($list); $i++) {
$list[$i]['channel'] = get_data('channel', $list[$i]['art_channel_id'], 'cha_code');
$list[$i]['short_title'] = cut_str($list[$i]['art_title'], 16);
}
$smarty->assign('best_article', $list);
}
示例4: module_tailor_sheet
function module_tailor_sheet()
{
global $global, $smarty;
$obj = new varia();
$obj->set_where("var_name = 'tailor_data_cat'");
$list = $obj->get_list();
if (count($list)) {
for ($i = 0; $i < count($list); $i++) {
$arr = explode('|', $list[$i]['var_value']);
$cat_list[$i]['server_id'] = $arr[0];
$cat_list[$i]['server_name'] = $arr[1];
}
} else {
$cat_list = array();
}
$smarty->assign('cat_list', $cat_list);
$data_username = rawurlencode(get_varia('data_username'));
$data_password = rawurlencode(get_varia('data_password'));
$cat = get_global('cat');
$page = get_global('page');
$prefix = 'data/mod-tailor_sheet';
$page_sum = 1;
$sheet = array();
if ($cat) {
$prefix = $prefix . '/cat-' . $cat;
}
$url = S_SERVER_URL . 'tailor.php?/tailor/cat-' . $cat . '/page-' . $page . '/data_username-' . $data_username . '/data_password-' . $data_password . '/index.html';
$str = file_get_contents($url);
$result = json_decode(rawurldecode($str), true);
if (is_array($result)) {
if ($result['error'] == 'no') {
$sheet = $result['sheet'];
for ($i = 0; $i < count($sheet); $i++) {
$obj = new article();
$obj->set_where("art_title = '" . $sheet[$i]['art_title'] . "'");
if ($obj->get_count()) {
$sheet[$i]['is_exist'] = 1;
} else {
$sheet[$i]['is_exist'] = 0;
}
}
$page_sum = $result['page_sum'];
}
}
$smarty->assign('page_sum', $page_sum);
$smarty->assign('prefix', $prefix);
$smarty->assign('article', $sheet);
}
示例5: module_edit
function module_edit()
{
global $global, $smarty;
$obj = new article();
$obj->set_where('art_id = ' . $global['id']);
$one = $obj->get_one();
$smarty->assign('article', $one);
$smarty->assign('editor_text', $one['art_text']);
$list = array();
$obj = new cat_art();
$obj->set_where('cat_channel_id = ' . $global['channel_id']);
$arr = $obj->get_list();
if (count($arr) > 0) {
$list = $obj->set_cat_order($arr);
}
$smarty->assign('cat_list', $list);
$smarty->assign('upl_date', date('Ymd'));
}
示例6: module_search_main
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);
}
示例7: module_article_main
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);
}
}
示例8: do_del_channel
function do_del_channel($channel_id)
{
//判断频道是否已存在
$obj = new channel();
$obj->set_where('');
$obj->set_where("cha_id = {$channel_id}");
$channel = $obj->get_one();
if (count($channel)) {
$cha_code = $channel['cha_code'];
$obj->del();
} else {
return 0;
}
//删除前台导航(导航管理)
$obj = new varia();
$obj->set_where("var_name = 'nav_stage_" . $cha_code . "'");
$obj->del();
//删除后台导航(导航管理)
$obj->set_where('');
$obj->set_where("var_name = 'nav_admin_" . $cha_code . "'");
$obj->del();
//删除后台导航菜单
$obj = new menu();
$obj->set_where("men_type = '{$cha_code}'");
$obj->del();
$obj->set_where('');
$obj->set_where("men_type = 'admin_header'");
$obj->set_where("men_url = '" . $cha_code . "/mod-sheet/'");
$obj->del();
$obj->set_where('');
$obj->set_where("men_type = 'admin_" . $cha_code . "'");
$obj->set_where("men_url = '" . $cha_code . "/mod-sheet/'");
$obj->del();
$obj->set_where('');
$obj->set_where("men_type = 'admin_" . $cha_code . "'");
$obj->set_where("men_url = '" . $cha_code . "/mod-add/'");
$obj->del();
$obj->set_where('');
$obj->set_where("men_type = 'admin_" . $cha_code . "'");
$obj->set_where("men_url = '" . $cha_code . "/mod-cat_list/'");
$obj->del();
$obj->set_where('');
$obj->set_where("men_type = 'admin_" . $cha_code . "'");
$obj->set_where("men_url = '" . $cha_code . "/mod-att_list/'");
$obj->del();
//删除前台导航菜单
$obj = new menu();
$obj->set_where("men_type = 'header'");
$obj->set_where("men_url = '" . $cha_code . "/'");
$obj->del();
//删除分类
$obj = new cat_art();
$obj->set_where('');
$obj->set_where("cat_channel_id = {$channel_id}");
$obj->del();
//删除内容
$obj = new article();
$obj->set_where('');
$obj->set_where("art_channel_id = {$channel_id}");
$obj->del();
//删除属性
$obj = new att_art();
$obj->set_where('');
$obj->set_where("att_channel_id = {$channel_id}");
$obj->del();
//删除语言包
$path = 'languages/' . S_LANG . '/admin/' . $cha_code . '.txt';
if (file_exists($path)) {
unlink($path);
}
$path = 'languages/' . S_LANG . '/index/' . $cha_code . '.txt';
if (file_exists($path)) {
unlink($path);
}
//修改伪静态文件
$path = 'admin/module/basic/htaccess.txt';
if (file_exists($path)) {
$str = file_get_contents($path);
$rule = "\n" . 'RewriteRule ^' . $cha_code . '/(.*)$ index.php?/' . $cha_code . '/$1';
$str = str_replace($rule, '', $str);
file_put_contents($path, $str);
}
return 1;
}
示例9: add_or_edit_article
function add_or_edit_article()
{
global $global, $smarty, $lang;
$art_id = post('art_id');
$art_title = post('art_title');
$art_cat_id = post('art_cat_id');
$art_author = post('art_author');
$att_url = post('file_path');
$art_text = post('editor', 'loose');
$art_keywords = post('art_keywords');
$art_description = post('art_description');
$art_add_time = time();
$arr = array();
$obj = new att_art();
$obj->set_where('');
$obj->set_where('att_channel_id = ' . $global['channel_id']);
$att = $obj->get_list();
for ($i = 0; $i < count($att); $i++) {
$att_value = post($att[$i]['att_code']);
if ($att_value != '') {
$arr[$att[$i]['att_id']] = $att_value;
}
}
$art_attribute = rawurlencode(json_encode($arr));
if ($art_cat_id == '') {
$art_cat_id = 0;
}
$art_text = str_replace('<p><br/></p>', '', $art_text);
$art_text = str_replace('<p><br /></p>', '', $art_text);
$art_description = cut_str($art_description, 250);
$obj = new article();
$obj->set_value('art_title', $art_title);
$obj->set_value('art_cat_id', $art_cat_id);
$obj->set_value('art_author', $art_author);
$obj->set_value('art_text', $art_text);
$obj->set_value('art_keywords', $art_keywords);
$obj->set_value('art_description', $art_description);
$obj->set_value('art_add_time', $art_add_time);
$obj->set_value('art_attribute', $art_attribute);
if ($art_id != '') {
$obj->set_where("art_id = {$art_id}");
$obj->edit();
$info_text = $lang['edit_article_success'];
} else {
$obj->set_value('art_channel_id', $global['channel_id']);
$obj->set_value('art_lang', S_LANG);
$obj->add();
$info_text = $lang['add_article_success'];
}
if (intval(get_varia('single_page_static'))) {
$page_id = $art_id;
if ($page_id == '') {
$obj->set_where("art_add_time = {$art_add_time}");
$one = $obj->get_one();
if (count($one)) {
$page_id = $one['art_id'];
}
}
if ($page_id != '') {
$domain = get_domain();
$page_url = 'http://' . $domain . S_ROOT . url(array('channel' => $global['channel'], 'id' => $page_id));
$html = file_get_contents($page_url);
}
}
$smarty->assign('info_text', $info_text);
$smarty->assign('link_text', $lang['return_list']);
$smarty->assign('link_href', url(array('channel' => $global['channel'], 'mod' => 'sheet')));
}