/** * 获取当前项目记录页的项目记录数范围 * * @param string $page * @param string $pid * @return string */ function get_item_page_item_range($page = NULL, $pid = NULL) { if ($pid == NULL) { $pid = get_item_current_id(); } if ($page == NULL) { $page = get_item_current_page($pid); } $per_page = 20; $page = $page <= 0 ? 1 : $page; $item_num = get_item_num($pid); if ($item_num == 0) { return "Empty"; } $first_item = $per_page * ($page - 1) + 1; $last_item = $first_item + $per_page - 1; if ($last_item > $item_num) { $last_item = $item_num; } return "{$first_item} - {$last_item}"; }
?> <div class="main"> <div class="top-bar"> <div class="top-bar-title"> <?php echo esc_html(get_project_name($id)); ?> </div> </div> <div class="main-item-projs-items-bar"> <div class="pagination"> <span><small><?php echo esc_html(get_item_page_item_range()); ?> , Total <?php echo esc_html(get_item_num($id)); ?> </small></span> <a type="button" class="btn btn-default btn-xs btn-page" href="<?php echo get_item_prevpageurl(); ?> "><span class="glyphicon glyphicon-chevron-left"></span> Prev</a> <a type="button" class="btn btn-default btn-xs btn-page" href="<?php echo get_item_nextpageurl(); ?> ">Next <span class="glyphicon glyphicon-chevron-right"></span></a> </div>
function genDestNumCache($kindid) { $linenum = get_item_num($kindid, 1); $hotelnum = get_item_num($kindid, 2); $carnum = get_item_num($kindid, 3); $articlenum = get_item_num($kindid, 4); $spotnum = get_item_num($kindid, 5); $photonum = get_item_num($kindid, 6); $filepath = SLINEDATA . '/dest/cache/' . $kindid . '.cache.php'; $fp = fopen($filepath, 'w'); flock($fp, 3); fwrite($fp, "<" . "?php\r\n"); fwrite($fp, "return array(\r\n"); $content .= "'linenum'=>'" . $linenum . "',"; $content .= "'hotelnum'=>'" . $hotelnum . "',"; $content .= "'carnum'=>'" . $carnum . "',"; $content .= "'articlenum'=>'" . $articlenum . "',"; $content .= "'spotnum'=>'" . $spotnum . "',"; $content .= "'photonum'=>'" . $photonum . "'"; $content .= ")\r\n"; fwrite($fp, $content); fwrite($fp, "?" . ">"); fclose($fp); }