function f_show_detail() { global $gl_array; // 関数の中で関数の外の変数/配列を使用する場合に宣言 extract($gl_array); // 配列データ名を変数名へ置換 if ($id != "") { $sql = "SELECT * FROM t_fish_recipe"; // テーブル一覧取得 $sql .= " WHERE id ='" . mysql_real_escape_string($id) . "'"; // 選択されたID取得 $rs = f_db_query($sql); // SQL実行 $row = f_db_fetch($rs); // 取得データを配列へ } $image_dir = IMG_FILE . $row['image_path']; // 画像保存先フルパス $c_body = preg_replace("/\r\n|\r|\n/", "<br>", $row['body']); // 改行コードを<br>へ置換 $c_material = preg_replace("/\r\n|\r|\n/", "<br>", $row['material']); // 改行コードを<br>へ置換 $c_make = preg_replace("/\r\n|\r|\n/", "<br>", $row['make']); // 改行コードを<br>へ置換 ?> <!-- HTML --> <div id="nav"><a href="/">トップ</a> > <a href="./">釣魚レシピ</a> > <?php echo $row['title']; ?> </div> <div class="center"> <img src="img/banner_recipe.jpg" width="100%"> </div> <!-- 料理名 --> <div class="bass_h2"> <?php echo $row['title']; ?> </div> <div clear="all" style="clear:both;"></div> <!-- 提供 --> <span class="new"> 提供:<?php echo $row['offer']; ?> </span> <div clear="all" style="clear:both;"></div> <img src="<?php echo $image_dir; ?> " width="80" align="left" style="margin:5px;"> <!-- 内容 --> <div class="bass_tx"> <?php echo $c_body; ?> </div> <div clear="all" style="clear:both;"></div> <!-- 材料 --> <div class="bass_h2">材料</div> <div class="bass_tx"> <?php echo $c_material; ?> </div><br /> <!-- 作り方 --> <div class="bass_h2">作り方</div> <div class="bass_tx"> <?php echo $c_make; ?> </div><br /> <!-- 動画 --> <div class="bass_h2">詳しい調理方法は動画で!!</div> <div id="myContent" style="width:280px;"> <script type="text/javascript" charset="utf-8" src="<?php echo $row['movie_path']; ?> "></script> </div> <?php }
function f_show_list() { global $gl_array; // 関数の中で関数の外の変数/配列を使用する場合に宣言 extract($gl_array); // 配列データ名を変数名へ置換 #================================================= # DB一覧取得処理 #================================================= $sql = "SELECT * FROM t_fish_recipe"; // テーブル一覧取得 $sql .= " WHERE now() > posted_day"; // 現在日付以前取得 $sql .= " AND posted_flg = '1'"; $sql .= " ORDER BY posted_day DESC"; // 最新日付で昇順にソート $res = f_db_query($sql); // SQL実行 $num = f_db_num_rows($res); // テーブル件数取得 #================================================= # TABLE一覧配列格納処理 #================================================= if ($num > 0) { // DB取得テーブルが1件以上なら以下の処理を行う $array_data = array(); while ($row = f_db_fetch($res)) { // DB取得データをShift-Jisへ変換し、配列へ $array_data[] = array("id" => $row['id'], "title" => $row['title'], "image_path" => $row['image_path'], "posted_day" => $row['posted_day']); } #================================================= # Paging処理 #================================================= $perPage = 20; // 一覧表示件数設定 $params = array("perPage" => $perPage, "itemData" => $array_data, "extraVars" => array()); $o_page = Pager::factory($params); foreach ($o_page->getPageData() as $item) { $data_list_for_page[] = $item; } $navi = $o_page->getLinks(); echo $navi['all']; // 先頭 Paging 表示 } else { // DB取得テーブルが0件なら以下のメッセージ表示 f_show_mes("予期せぬエラーが発生しました。管理者へ問合せて下さい。"); } #================================================= # 画面表示処理 #================================================= for ($i = 0; $i < count($data_list_for_page); $i++) { $pday = date("n/j", strtotime($data_list_for_page[$i]['posted_day'])) . "UP!"; // 掲載月日設定 $image_dir = IMG_FILE . $data_list_for_page[$i]['image_path']; // 画像保存先フルパス $id_name = "detail" . $i; if ($i % 2 == 0) { // 偶数奇数を判定し、背景色入替 $style = "style ='background-color:#cce8ff'"; } else { $style = ""; } ?> <!-- HTML出力 --> <li class="fvmlist" <?php echo $style; ?> > <!-- 詳細画面遷移[選択ID]POST --> <a href="javascript:onclick=document.getElementById('<?php echo $id_name; ?> ').submit();"> <img src="<?php echo $image_dir; ?> " width="80" align="left" style="margin:5px;"> <div class="bass_img"> <span class="bass_tx4"><?php echo $data_list_for_page[$i]["title"]; ?> </span> <span class="new"><?php echo $pday; ?> </span> </div> <div clear="all" style="clear:both;"></div> </a> <form method="POST" action="./detail.php" id="<?php echo $id_name; ?> "> <input type="hidden" name="id" value="<?php echo $data_list_for_page[$i]['id']; ?> "/> </form> </li> <?php } if ($num > 0) { // DB取得テーブルが1件以上なら以下の処理を行う echo $navi['all']; // 末尾 Paging 表示 } }
function f_db_count($pa_from, $pa_where) { global $con; $lo_Sql = " SELECT COUNT(*) AS cnt FROM " . $pa_from; if ($pa_where != "") { $lo_Sql .= " WHERE " . $pa_where; } $lo_rs = f_db_query($lo_Sql); // SQL実行(SQLクエリーを実行) $lo_aryFld = f_db_fetch($lo_rs); return $lo_aryFld["cnt"]; }
function f_show_detail() { global $gl_array, $array_data, $page_list; // 関数の中で関数の外の変数/配列を使用する場合に宣言 extract($gl_array); // 配列データ名を変数名へ置換 if ($catalogue_id != "") { $sql = "SELECT * FROM dt_catalogue"; // テーブル一覧取得 $sql .= " WHERE catalogue_id ='" . mysql_real_escape_string($catalogue_id) . "'"; // 選択されたID取得 $rs = f_db_query($sql); // SQL実行 $row = f_db_fetch($rs); // 取得データを配列へ } #================================================= # 改行コード ⇒ <br> 置換処理 #================================================= $n_infomation = preg_replace("/\r\n|\r|\n/", "<br>", $row['infomation']); #================================================= # date型 ⇒ Y年m月d日 置換処理 #================================================= list($year, $mon, $day) = explode("-", $row['sale_date']); $sale = $year . "年" . $mon . "月" . $day . "日"; ?> <form method = "POST" action="<?php echo $_SERVER['SCRIPT_NAME']; ?> "> <div id="titlelist_col"> <div class="dvd_title clearfix"> <div class="dvd_cover2"> <table> <tr> <td> <a href="<?php echo IMG_CATALOGUE . $row['image']; ?> " rel="lightbox[photo]" title="<?php echo IMG_CATALOGUE . $row['image']; ?> "> <img src="<?php echo IMG_CATALOGUE . $row['image']; ?> " width="220" /> </a> </td> </tr> <tr> <td> <a href="<?php echo IMG_CATALOGUE . $row['image']; ?> " rel="lightbox[photo]" title="<?php echo IMG_CATALOGUE . $row['image']; ?> "> <img src="./img/btn/zoom_btn.gif" width="100" height="17" /> </a> </td> </tr> </table> </div> <div class="dvd_data2"> <h2><?php echo $row['main_title']; ?> </h2> <p> <span class="headline"><?php echo $row['sub_title']; ?> </span><br /> <?php echo $n_infomation; ?> </p> <table> <tr> <td class="goods_title">発売日</td> <td class="goods_detail"><?php echo $sale; ?> </td> </tr> <tr> <td class="goods_title">収録時間</td> <td class="goods_detail"><?php echo $row['recording']; ?> </td> </tr> <tr> <td class="goods_title">JANコード</td> <td class="goods_detail"><?php echo $row['jan']; ?> </td> </tr> <tr> <td class="goods_title">価格</td> <td class="goods_detail"><?php echo $row['price']; ?> 円(税込)</td> </tr> </table> </div> </div> </div> </form> <div class="shop_link"> <img src="../images/arrow_w.png" class="link_icon" /> <a href="../data/shop/">釣具店一覧へ</a> </div> <?php }