Toggle main menu visibility
新聞
下載
教材
影音
討論
其他選單
好站連結
行事曆
電子相簿
常見問題
萬用表單
即時留言簿
友站消息
社大學員
:::
登入
登入
帳號
密碼
登入
重整畫面
:::
所有書籍
「[1011]XOOPS 2.5 模組開發」目錄
MarkDown
9. XOOPS文字過濾
1. XOOPS模組開發
2. XOOPS模組基本結構
3. 模組管理後台結構
3-1 上課範例:tad0616.sql
3-2 上課範例:xoops_version.php
3-3 上課範例:admin/menu.php
4. XOOPS的表單Class
4-1 admin/cate.php
5. 分類管理功能
5-1 上課範例:admin/cate.php
6. 修改及前台結構
6-1 上課範例:admin/cate.php
6-2 上課範例:index.php
6-3 上課範例:xoops_version.php
7. 前台自製表單
7-1 上課範例:index.php
7-2 上課範例:class/ckeditor/config.js
8. 強化編輯器及月曆
8-1 上課範例:class/ckeditor/config.js
8-2 上課範例:class/ckeditor/kcfinder/config.php
8-3 上課範例:index.php
9. XOOPS文字過濾
9-1 上課範例:index.php
10. 選單及前台功能
10-1 上課範例:index.php
11. 內建搜尋功能與語系
11-1 上課範例:include/search.php
11-2 上課範例:xoops_version.php
11-3 上課範例:language/tchinese_utf8/modinfo.php
11-4 上課範例:admin/menu.php
11-5 上課範例:language/tchinese_utf8/admin.php
11-6 上課範例:admin/cate.php
11-7 上課範例:language/tchinese_utf8/main.php
11-8 上課範例:index.php
12. 偏好設定與分頁
12-1 上課範例:index.php
12-2 上課範例:function.php
12-3 上課範例:xoops_version.php
13. XOOPS的樣板檔
13-1 上課範例:xoops_version.php
13-2 上課範例:templates/tad_note_index.html
13-3 上課範例:index.php
13-4 上課範例:view.php
13-5 上課範例:include/search.php
13-6 上課範例:templates/tad_note_view.html
14. XOOPS的評論功能
14-1 上課範例:index.php
14-2 上課範例:templates/tad_note_index.html
14-3 上課範例:templates/tad_note_view.html
14-4 上課範例:xoops_version.php
14-5 上課範例:view.php
14-6 上課範例:comment_new.php
14-7 上課範例:themes/school2012/css/itensXoops.css
15. 製作XOOPS區塊
15-1 上課範例:xoops_version.php
15-2 上課範例:blocks/new_notes.php
15-3 上課範例:templates/blocks/new_notes.html
16. 通知功能(上)
16-1 上課範例:index.php
16-2 上課範例:templates/tad_note_index.html
16-3 上課範例:xoops_version.php
16-4 上課範例:include/notification.inc.php
16-5 上課範例:templates/tad_note_view.html
17. XOOPS通知功能(下)
17-1 上課範例:index.php
17-2 上課範例:language/tchinese_utf8/mail_template/new_note.tpl
17-3 上課範例:language/tchinese_utf8/mail_template/new_cate_note.tpl
17-4 上課範例:function.php
17-5 上課範例:admin/cate.php
18. 細部權限及自動功能
18-1 上課範例:admin/menu.php
18-2 上課範例:admin/groupperm.php
18-3 上課範例:view.php
18-4 上課範例:index.php
18-5 上課範例:xoops_version.php
18-6 上課範例:include/onInstall.php
18-7 上課範例:include/onUpdate.php
18-8 上課範例:include/onUninstall.php
10. 選單及前台功能
\[1011\]XOOPS 2.5 模組開發 ====================== ``` render(); $option=""; //抓取資料庫中的分類選項 $sql="select * from ".$xoopsDB->prefix("tad_note_cate")." where cate_enable='1' order by `cate_sort`"; $result = $xoopsDB->query($sql) or redirect_header('index.php', 3, mysql_error()); while($cate=$xoopsDB->fetchArray($result)){ $option.="
{$cate['cate_title']}
"; } //取得最大排序 $note_sort=get_max_sort(); //取得現在時間 $note_date=date("Y-m-d H:i:s"); $main="
記事編輯
所屬分類
不分類
$option
文章標題
發布日期
是否公開
是
否
排序
$token
"; /* 所屬分類 cate_sn 文章標題 note_title 文章內容 note_content 發布日期 note_date 是否公開 note_public 排序 note_sort */ return $main; } //儲存文章 function save(){ global $xoopsDB , $xoopsUser; if(!$GLOBALS['xoopsSecurity']->check()){ $error=implode("
" , $GLOBALS['xoopsSecurity']->getErrors()); redirect_header($_SERVER['PHP_SELF'],3, $error); } $myts =& MyTextSanitizer::getInstance(); $_POST['note_title'] = $myts->addSlashes($_POST['note_title']); $_POST['note_content'] = $myts->addSlashes($_POST['note_content']); $_POST['note_date'] = $myts->addSlashes($_POST['note_date']); $_POST['note_sort'] = $myts->addSlashes($_POST['note_sort']); $uid = empty($xoopsUser)? 0 : $xoopsUser->uid(); $sql="insert into ".$xoopsDB->prefix("tad_notes")." (`cate_sn`, `note_title`, `note_content`, `note_date`, `note_public`, `note_count`, `uid`, `note_sort`) values('{$_POST['cate_sn']}' , '{$_POST['note_title']}' , '{$_POST['note_content']}' , '{$_POST['note_date']}' , '{$_POST['note_public']}' , '0' , '{$uid}' , '{$_POST['note_sort']}')"; $xoopsDB->query($sql) or redirect_header('index.php', 3, mysql_error()); } //工具列 function toolbar(){ $main="
新增記事
"; return $main; } //取得最大排序 function get_max_sort(){ global $xoopsDB; $sql="select max(`note_sort`) from ".$xoopsDB->prefix("tad_notes")." where `note_public`='1'"; $result=$xoopsDB->query($sql) or redirect_header('index.php', 3, mysql_error()); list($max_sort)=$xoopsDB->fetchRow($result); return ++$max_sort; } //顯示文章列表或單一文章 function show_doc($note_sn=''){ global $xoopsDB; $myts =& MyTextSanitizer::getInstance(); if(empty($note_sn)){ $sql="select * from ".$xoopsDB->prefix("tad_notes")." where `note_public`='1' order by note_sort"; $result=$xoopsDB->query($sql) or redirect_header('index.php', 3, mysql_error()); $main="
"; while($doc=$xoopsDB->fetchArray($result)){ $doc['note_title'] = $myts->htmlSpecialChars($doc['note_title']); $doc['note_date'] = $myts->htmlSpecialChars($doc['note_date']); $main.="
{$doc['note_title']}
{$doc['note_date']}
"; } $main.="
"; }else{ $sql="select * from ".$xoopsDB->prefix("tad_notes")." where `note_sn`='$note_sn' and `note_public`='1'"; $result=$xoopsDB->query($sql) or redirect_header('index.php', 3, mysql_error()); $doc=$xoopsDB->fetchArray($result); $doc['note_title'] = $myts->htmlSpecialChars($doc['note_title']); $doc['note_date'] = $myts->htmlSpecialChars($doc['note_date']); $doc['note_content'] = $myts->displayTarea($doc['note_content'], 1, 1, 0, 1, 0); $main="
{$doc['note_title']}
{$doc['note_date']}
{$doc['note_content']}
"; } return $main; } /*** 流程判斷 ***/ $op = empty($_REQUEST['op'])? "" : $_REQUEST['op']; $note_sn = empty($_REQUEST['note_sn'])? "" : intval($_REQUEST['note_sn']); switch($op){ case "save": save(); header("location:index.php"); break; case "add_form": $main=add_form(); break; default: $main=show_doc($note_sn); break; } /*** 輸出 ***/ echo $main; include_once XOOPS_ROOT_PATH.'/footer.php'; ?> ```
:::
搜尋
search
進階搜尋
QR Code 區塊
快速登入
所有討論區
「PHP全端開發」線上課程討論區
XOOPS使用討論區
一般研習學員
社大學員專用
路過哈啦區
XOOPS佈景設計
XOOPS模組開發
Tad書籍區
即時留言簿
書籍目錄
展開
|
闔起
線上使用者
94
人線上 (
26
人在瀏覽
線上書籍
)
會員: 0
訪客: 94
更多…