本文整理汇总了PHP中article::set_page_size方法的典型用法代码示例。如果您正苦于以下问题:PHP article::set_page_size方法的具体用法?PHP article::set_page_size怎么用?PHP article::set_page_size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类article
的用法示例。
在下文中一共展示了article::set_page_size方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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_new_article
function module_new_article()
{
global $smarty;
$obj = new article();
$obj->set_field('art_id,art_channel_id,art_title,art_add_time');
$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('new_article', $list);
}
示例4: 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);
}
示例5: 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);
}
}