摄影空间

minispace二次开发详解(二)

上一篇 / 下一篇  2007-09-13 12:07:50 / 个人分类:测试

查看( 124 ) / 评论( 10 )
minispace二次开发详解(一)

接上会说起:
本次主要一步一步制作一个minispace的相册功能.

QUOTE:

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'] = 'cdb_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><br>
                                        <!--{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><br>
                                        <!--{/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><br>
                                        <!--{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><br>
                                        <!--{/if}-->
                                <!--{/if}-->
                        <!--{/if}--><br>
                <!--{/loop}-->
                </div>
        <!--{/if}-->
        </div>

<!--{eval
}
7、程序修改结束,接下来就是数据修改
参考minispace二次开发详解(一)
中的1到4步设定数据。
8、清理缓存,就可以了
mini相册演示

明日有空继续mini的功能。准备添加计数器功能
广告一下演示站点
www.veip.cn
站点还没有开发完成。只是测试,所以数据都是乱的。
主要使用dede为基础,整合ask,js4,dz6,而成。

关于minisapce的演示

TAG:

我来说两句

(可选)

数据统计

  • 访问量: 1439
  • 日志数: 3
  • 图片数: 1
  • 建立时间: 2006-10-16
  • 更新时间: 2007-09-13

RSS订阅

Open Toolbar