from:
http://www.discuz.net/thread-740522-1-6.html
minispace 二次開發詳解(二)
minispace 二次開發詳解(一)
接上會說起:
本次主要一步一步製作一個 minispace 的相冊功能.
1、打開 include 下面的 space.func.
php 檔,這個檔案就是主要負責產生 mini 的函數檔案
2、$modulesettings = array( //'模組標識名稱' => array('不允許出現的位置', 預設位置, 隱藏更多連結)位置中數字 0 代表左側、1 代表中間、2 代表右側,不允許出現的位置如果不允許出現在 2 個位置,用逗號分割
在 $modulesettings 數組中添加
複製內容到剪貼簿
代碼:
'myattachments' => array('', 1),3、$listmodule = array( //為包含列表內容模組的聲明數組,所有的包含列表內容的模組在此處聲明,含義為:'模組標識名稱' => 選單順序
在 $listmodule 數組中添加
複製內容到剪貼簿
代碼:
'myattachments' => 7,4、修改 function spacecaches 函數。獲得用戶的 space 快取資料。@param string $uid 用戶 uid。@param string $modulelist 模組列表(用戶設定的開啟的模組)如果為空的話則更新所有的模組
在 $allmodules 數組中添加
複製內容到剪貼簿
代碼:
'myattachments', //note 我的圖片5、在檔案最後添加 module_myattachments 函數處理得到圖片訊息
複製內容到剪貼簿
代碼:
function module_myattachments(&$parms) {
global $uid, $tablepre;
$parms['table'] = 'attachments a';
$parms['cols'] = ' a.*, t.subject';
$parms['conditions'] = "LEFT JOIN {$tablepre}threads t USING(tid) WHERE a.uid='$uid' AND a.readperm=0 AND t.displayorder>=0 AND a.isimage=1 ORDER BY a.dateline DESC";
}6、修改 mini
模板。由於 mini 是單
模板對多 css 結構,因此只需要修改一次,終生受益。哈哈
打開 space_module.htm
在最後 }--> 之前加入。下面的模板解析函數。就可以
複製內容到剪貼簿
代碼:
function myattachments($moduledata, $center = '') {
global $mod, $multipage, $thumbstatus, $ftp, $attachurl;
}-->
<div id="module_mythreads" align="center" style="margin-top:-6px">
<!--{if $mod}-->
<link rel="stylesheet" type="text/css" href="/images/cmsmb_com/index/spaceimg.css" />
<ul class="veip-img">
<!--{loop $moduledata $attach}-->
<!--{eval $attach['url'] = $attach['remote'] ? $ftp['attachurl'] : $attachurl;}-->
<!--{if !$attach['price'] || $attach['payed']}-->
<li class="veip-avatarimg veip-imgstyle">
<!--{if $thumbstatus && $attach['thumb']}-->
<!--{if ($attachrefcheck || $attach['remote']) && !($attach['remote'] && substr($ftp['attachurl'], 0, 3) == 'ftp' && !$ftp['hideurl'])}-->
<a href="redirect.php?goto=findpost&pid=$attach[pid]&ptid=$attach[tid]" target="_blank"><img src="attachment.php?aid=$attach[aid]" border="0" alt="$attach[subject]" /></a>
<!--{else}-->
<a href="redirect.php?goto=findpost&pid=$attach[pid]&ptid=$attach[tid]" target="_blank"><img src="$attach[url]/$attach[attachment].thumb.jpg" border="0" alt="$attach[subject]" /></a>
<!--{/if}-->
<!--{else}-->
<!--{if ($attachrefcheck || $attach['remote']) && !($attach['remote'] && substr($ftp['attachurl'], 0, 3) == 'ftp' && !$ftp['hideurl'])}-->
<a href="redirect.php?goto=findpost&pid=$attach[pid]&ptid=$attach[tid]" target="_blank"><img src="attachment.php?aid=$attach[aid]&noupdate=yes" border="0" alt="$attach[subject]" /></a>
<!--{else}-->
<a href="redirect.php?goto=findpost&pid=$attach[pid]&ptid=$attach[tid]" target="_blank"><img src="$attach[url]/$attach[attachment]" border="0" alt="$attach[subject]" /></a>
<!--{/if}-->
<!--{/if}-->
<p>$attach['subject']</p>
</li>
<!--{/if}-->
<!--{/loop}-->
</ul>
<div class="line" style="clear: both"></div>
$multipage
<!--{else}-->
<div class="side" align="center">
<!--{loop $moduledata $attach}-->
<!--{eval $attach['url'] = $attach['remote'] ? $ftp['attachurl'] : $attachurl;}-->
<!--{if !$attach['price'] || $attach['payed']}-->
<!--{if $thumbstatus && $attach['thumb']}-->
<!--{if ($attachrefcheck || $attach['remote']) && !($attach['remote'] && substr($ftp['attachurl'], 0, 3) == 'ftp' && !$ftp['hideurl'])}-->
<a href="redirect.php?goto=findpost&pid=$attach[pid]&ptid=$attach[tid]" target="_blank"><img src="attachment.php?aid=$attach[aid]" border="0" alt="$attach[subject]" width="80%" /></a>
<!--{else}-->
<a href="redirect.php?goto=findpost&pid=$attach[pid]&ptid=$attach[tid]" target="_blank"><img src="$attach[url]/$attach[attachment].thumb.jpg" border="0" alt="$attach[subject]" width="80%" /></a>
<!--{/if}-->
<!--{else}-->
<!--{if ($attachrefcheck || $attach['remote']) && !($attach['remote'] && substr($ftp['attachurl'], 0, 3) == 'ftp' && !$ftp['hideurl'])}-->
<a href="redirect.php?goto=findpost&pid=$attach[pid]&ptid=$attach[tid]" target="_blank"><img src="attachment.php?aid=$attach[aid]&noupdate=yes" border="0" width="80%" alt="$attach[subject]" /></a>
<!--{else}-->
<a href="redirect.php?goto=findpost&pid=$attach[pid]&ptid=$attach[tid]" target="_blank"><img src="$attach[url]/$attach[attachment]" border="0" width="80%" alt="$attach[subject]" /></a>
<!--{/if}-->
<!--{/if}-->
<!--{/if}-->
<!--{/loop}-->
</div>
<!--{/if}-->
</div>
<!--{eval
}7、程序修改結束,接下來就是資料修改
參考 minispace 二次開發詳解(一)
中的 1 到 4 步設定數據。
8、清理快取,就可以了 mini 相冊演示
明日有空繼續 mini 的功能。準備添加計數器功能
廣告一下演示網站
www.veip.cn
網站還沒有開發完成。只是測試,所以資料都是亂的。
主要使用 dede 為基礎,整合 ask,js4,dz6,而成。
關於 minisapce 的演示