線上書籍

Home

[1011]XOOPS 2.5 模組開發

<?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; } ?>