:::

11-2 上課範例:pda.php

<?php
/*-----------引入檔案區--------------*/
include_once "header.php";
include_once "up_file.php";
/*-----------function區--------------*/

//抓所有分類
$cate=get_contact_cate_all();

$sql = "select * from `".$xoopsDB->prefix("contact")."` ";
$result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'],3, mysql_error());
$content="<li data-role='list-divider'>所有通訊錄列表</li>";
while($all=$xoopsDB->fetchArray($result)){
	//以下會產生這些變數: $tel , $email , $name , $gsn , $sn , $birthday , $zip , $county , $city , $addr
	foreach($all as $k=>$v){
		$$k=$v;
	}
	
	$photo_file = get_pic_file('photo' , $sn , 1 , 'thumb');
  $photo=empty($photo_file)?"" : "<img src='{$photo_file}'>";
	
	$content.="
  <li>
  <a href='data.php?sn=$sn'>{$photo}<h3>{$name}</h3><p>電話:{$tel} 信箱:{$email}</p></a>
  <span class='ui-li-count'>{$cate[$gsn]['title']}</span>
  </li>
  ";
	
}


echo "<!DOCTYPE html>
<html>
  <head>
   <title></title>
   <meta charset='utf-8'>
   <meta name='viewport' content='width=device-width, initial-scale=1'>
   <link rel='stylesheet' href='".XOOPS_URL."/modules/tadtools/jquery.mobile/jquery.mobile.css' />
   <script src='".XOOPS_URL."/modules/tadtools/jquery/jquery.js'></script>
   <script src='".XOOPS_URL."/modules/tadtools/jquery.mobile/jquery.mobile.js'></script>

  </head>
  <body>
  
  <div data-role='page' id='p1'>
    <div data-role='header'>
      <a data-icon='arrow-l' data-rel='back'>回上頁</a>
      <h1>所有通訊錄列表</h1>
      <a href='pda.php' data-icon='home'>回首頁</a>
    </div>
    <div data-role='content'>

      <ul data-role='listview' data-inset='false'>
        $content
      </ul>

    </div>
    <div data-role='footer'></div>
  </div>

  </body>
</html>
";
?>

:::

搜尋

QR Code 區塊

https%3A%2F%2Ftad0616.net%2Fmodules%2Ftad_book3%2Fpage.php%3Ftbsn%3D26%26tbdsn%3D787

書籍目錄

展開 | 闔起

線上使用者

139人線上 (12人在瀏覽線上書籍)

會員: 0

訪客: 139

更多…