1041 XOOPS模組開發
	
<?php
//顯示函數
function tad_ebook_list($options){
  global $xoopsDB ;
  //單一檔案真實路徑:
  include_once XOOPS_ROOT_PATH."/modules/tadtools/TadUpFiles.php" ;
  $TadUpFiles=new TadUpFiles("tad_ebook");
  $myts =& MyTextSanitizer::getInstance();
  $today=date("Y-m-d");
  $tbl=$xoopsDB->prefix('tad_ebook');
  $sql="select * from `{$tbl}` where `ebook_publish_date` <= '{$today}' order by `ebook_publish_date` desc";
  $result=$xoopsDB->query($sql) or die(mysql_error());
  $i=0;
  $all_data="";
  while($all=$xoopsDB->fetchArray($result)){
    $all['ebook_title']=$myts->htmlSpecialChars($all['ebook_title']);
    $TadUpFiles->set_col('ebook_sn',$all['ebook_sn']);
    $all['ebook_pic']=$TadUpFiles->get_pic_file('thumb');
    $all_data[$i]=$all;
    $i++;
  }
  $block['show_pic']=$options[0];
  $block['height']=$options[1];
  $block['all_data']=$all_data;
  return $block;
}
//設定函數
function tad_ebook_list_edit($options){
  $checked1=$options[0]=='1'?"checked":"";
  $checked0=$options[0]=='0'?"checked":"";
  $form="
  是否顯示縮圖?
  <input type='radio' name='options[0]' value='1' $checked1>是
  <input type='radio' name='options[0]' value='0' $checked0>否
  <br>
  區塊高度?
  <input type='text' name='options[1]' value='{$options[1]}'>
  ";
  return $form;
}
?>