:::

15-2 上課範例:blocks/new_notes.php

<?php
function new_notes($options){
  global $xoopsDB;

  $myts =& MyTextSanitizer::getInstance();
  $sql="select * from ".$xoopsDB->prefix("tad_notes")." where `note_public`='1' order by note_sort limit 0 , {$options[0]}";
  $result=$xoopsDB->query($sql) or redirect_header('index.php', 3, mysql_error());

  $i=0;
  $main="";
  while($doc=$xoopsDB->fetchArray($result)){

    $doc['note_title'] = $myts->htmlSpecialChars($doc['note_title']);
    $doc['note_date'] = $myts->htmlSpecialChars($doc['note_date']);
  
  	//$main.="<li><a href='".XOOPS_URL."/modules/tad_note/view.php?note_sn={$doc['note_sn']}'>{$doc['note_title']}</a></li>";
 
    $main[$i]['note_sn']=$doc['note_sn'];
    $main[$i]['note_title']=$doc['note_title'];
    $main[$i]['note_date']=$doc['note_date'];

    $i++;
  }
  
  $block['doc']=$main;
  $block['width']=$options[1];
  
  return $block; 
}


//區塊設定介面(編輯函數)
function new_notes_edit($options){
	$main="
	顯示文章數:<input type='text' name='options[0]' value='{$options[0]}'><br>
	區塊寬度:<input type='text' name='options[1]' value='{$options[1]}'>
	";
	return $main;
}
?>

:::

搜尋

QR Code 區塊

https%3A%2F%2Fwww.tad0616.net%2Fmodules%2Ftad_book3%2Fpage.php%3Ftbsn%3D22%26tbdsn%3D649

書籍目錄

展開 | 闔起

線上使用者

31人線上 (7人在瀏覽線上書籍)

會員: 0

訪客: 31

更多…