:::

18-8 function.php

<?php
/*
function.php 是用來放置共同函數的檔案
若有一些函數是前後台檔案會用到的,那麼可以將該函數放在這裡。
*/


//先確認 TadTools 是否存在
if(!file_exists(XOOPS_ROOT_PATH."/modules/tadtools/tad_function.php")){
  //若不存在提示安裝
  redirect_header("http://www.tad0616.net/modules/tad_uploader/index.php?of_cat_sn=50",3, _TAD_NEED_TADTOOLS);
}
//引入TadTools的函式庫,若沒載入此行,所有 tadtools 相關功能將無法使用
include_once XOOPS_ROOT_PATH."/modules/tadtools/tad_function.php";



//榮譽榜一覽
function list_honor(){
  global $xoopsTpl , $xoopsDB;

  $myts =& MyTextSanitizer::getInstance();

  //資料表套用前置字串
  $tbl=$xoopsDB->prefix("tad_honor");
  //撈取資料表內容的SQL語法
  $sql="select * from {$tbl} order by `honor_date` desc";

  //getPageBar($原sql語法, 每頁顯示幾筆資料, 最多顯示幾個頁數選項);
  $PageBar=getPageBar($sql, 10 , 10 );
  $bar=$PageBar['bar'];
  $sql=$PageBar['sql'];
  $total=$PageBar['total'];

  //送到資料庫執行
  $result = $xoopsDB->query($sql) or die(mysql_error());
  //取回一筆資料
  $i=1;
  $all_data="";
  while($all=$xoopsDB->fetchArray($result)){

    $all['honor_year']=$myts->htmlSpecialChars($all['honor_year']);
    $all['honor_date']=$myts->htmlSpecialChars($all['honor_date']);
    $all['honor_students']=$myts->htmlSpecialChars($all['honor_students']);
    $all['honor_descript']=$myts->htmlSpecialChars($all['honor_descript']);
    $all['honor_teachers']=$myts->htmlSpecialChars($all['honor_teachers']);
    $all['honor_note']=$myts->htmlSpecialChars($all['honor_note']);

    $all_data[$i]=$all;
    $i++;
  }

  //將資料陣列套到樣板檔
  $xoopsTpl->assign('all_data' , $all_data);
  $xoopsTpl->assign('bar' , $bar);
  $xoopsTpl->assign('temp_title' , '榮譽榜一覽');

}


?>

 


:::

搜尋

QR Code 區塊

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

書籍目錄

展開 | 闔起

線上使用者

48人線上 (10人在瀏覽線上書籍)

會員: 0

訪客: 48

更多…