require "admin2/inc_common.php";
/**************************************************************
15-07-16
タイトル、画像3枚、コメント
**************************************************************/
function disp_list() {
$sql = "select * from content_tb order by c_id desc";
$stmt = query_sql($sql);
if (($total = $stmt->rowCount())<1) {
return '情報はありません';
}
//ページ機能
// $page = 1;
$page = 10;
$p = ($_GET["p"]=="") ? 1 : $_GET["p"];
$st = ($p-1) * $page;
$sql.=" limit ".$st.",".$page;
$stmt = query_sql($sql);
$p_num = $stmt->rowCount();
$c = $total - ($p-1)*$page;
while($row=db_to_html($stmt->fetch(PDO::FETCH_ASSOC))) {
$image = "";
$comment = nl2br($row["comment"]);
$img_dir = "./data/image/";
for($i=0; $i<3; $i++) {
$img_file = $img_dir.floor($row["c_id"]/100)."/".$row["c_id"]."/".$i.".jpg";
if (file_exists($img_file)) {
$image.=<<
HTML;
}
}
$str.=<<No.{$c} {$row["title"]}
{$comment}
{$page_list}
HTML; return $str; } /*------------------------------------------------------------ ページの一覧 ------------------------------------------------------------*/ function page_info($page,$total,$p,$file) { if ($_GET) { $array = cnv_html($_GET); foreach($array as $key=>$val) { if ($key==='p') { continue; } $lnk.="&".$key."=".$val; } } //最後尾のページ $all_page = ceil($total/$page); if ($p > 1) { //ページトップでない $str = "≪前へ "; } if ($p >= 7) { //指定されたページが7以上なら1を離れて表示 $str.="1..."; $first = $p-4; $last = (($p+4)<$all_page) ? $p+4 : $all_page; } else { $first = 1; $last = (10>$all_page) ? $all_page : 10; } for($i=$first; $i<=$last; $i++) { if ($i==$p) { $str.="".$i." "; } else { $str.=<<{$i} HTML; } } if (($all_page>10) && ($last<$all_page)) { //指定されたページが7以上なら離れて最後尾を表示 $str.="...".$all_page.""; } if ($p < $all_page) { //ページ最後尾でない $str.=" 次へ≫"; } return $str; } ?>
ホーム > ビフォーアフター
Before and After