A-A+

dz2.5 Discuz二次开发手记 指定作者作品 OR 指定作品

2015年09月19日 15:23 学习笔记 暂无评论 共1766字 (阅读2,363 views次)

【注意:此文章为博主原创文章!转载需注意,请带原文链接,至少也要是txt格式!】

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**
食用方法:<!--{eval $lists = get_zdzzsl(60,153,array('5702', '3992'));}-->
        后面的数组可以为空,最后面的数组起排除作用,排除指定的作品。
**/
function get_zdzzsl($parentid,$authorid,$arr=array()){
	if(empty($arr)){
		$query = DB::query("SELECT v.*, m.pricehdj, m.pricemar  FROM ".DB::table('shop__title')." v LEFT JOIN ".DB::table('shop__content')." m ON m.aid=v.aid where v.authorid={$authorid} order by v.aid DESC  limit 0,{$parentid}");
	}else{
		$query = DB::query("SELECT v.*, m.pricehdj, m.pricemar  FROM ".DB::table('shop__title')." v LEFT JOIN ".DB::table('shop__content')." m ON m.aid=v.aid where v.authorid={$authorid} and v.aid NOT IN (".dimplode($arr).")  order by v.aid DESC  limit 0,{$parentid}");
	}
 
	while($row = DB::fetch($query)){
		$re[] = $row;
	}
return $re;
}
 
 
/**
食用方法:<!--{eval $lists = get_zdhp(array('5702', '3992'));}-->
**/
function get_zdhp($aid){
$query = DB::query("SELECT v.*, m.pricehdj, m.pricemar  FROM ".DB::table('shop__title')." v LEFT JOIN ".DB::table('shop__content')." m ON m.aid=v.aid where v.aid IN (".dimplode($aid).") ");
while($row = DB::fetch($query)){
       $re[] = $row;
	}
return $re;
}
 
 
 
function dimplode($array) {
        if(!empty($array)) {
		$array = array_map('addslashes', $array);
		return "'".implode("','", is_array($array) ? $array : array($array))."'";
	} else {
		return 0;
	}
}
public function fetch_catname_by_catid($catid,$asname = 'catname') {
     return DB::fetch_first("SELECT catname as $asname FROM ".DB::table($this->_table)." WHERE ".DB::field($this->_pk, $catid));
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
				<!--{eval $hh=1;}-->
				<!--{eval $lists = get_derhkh_job(60,153);}-->
				<!--{loop $lists $value}-->
				<!--{eval $pugtype = C::t('shop_category') -> fetch_catname_by_catid($value['pugid']);}-->
				<!--{eval $value[pic] = $value[pic]?pic_get($value['pic'], '', $value['thumb'], $value['remote'], 1, 1):'static/image/common/nophoto.gif';}-->
				<!--{eval $kunum = trim($value['stock'])+trim($value['xianstock'])+trim($value['yixingstock'])+trim($value['shenzhenstock']);}-->
 
                <td width="235" align="center" valign="middle"><table width="228" height="287" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td align="center" background="/images/kuang2.png"><table width="212" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td height="149" colspan="2" align="center"><a href="shop.php?id=$value[aid]" target="_blank"><img src="$value[pic]" width="210" height="147" border="0" /></a></td>
                      </tr>
                      <tr>
                        <td width="147"> &nbsp;{$value[authorname]}【<a href="javascript:display('goods_pic_$value[aid]');">$value[title]</a>】 </td>
                        <td width="65">库存:{$kunum}件</td>
                      </tr>
                      <tr>
                        <td colspan="2" align="center"><table width="208" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td width="94" align="left">你聊:$pugtype['catname']</td>
                            <td width="101" align="left">编号:<a href="shop.php?id=$value[aid]" target="_blank">$value[aid]</a></td>
                          </tr>
                          <tr>
                            <td align="left">溶剂:{$value[rongji]}cc</td>
                            <td align="left">价格:<span style="text-decoration: line-through;">{$value[pricemar]}元</span></td>
                          </tr>
                        </table></td>
                      </tr>
                      <tr>
                        <td colspan="2" align="center"><span class="f_02"><span class="f_021">活动价:</span></span><span style="color: #F00; text-decoration: none; font-family: &quot;微软雅黑&quot;;"><font size="+1"><b>{$value[pricehdj]}</b></font></span><span class="f_02"><span class="f_021"><font size="+1"><b>元</b></font></span></span></td>
                      </tr>
                      <tr>
                        <td height="29" colspan="2" align="center"><a href="shop.php?id=$value[aid]"  id="a_xunjia45" onclick="showWindow(this.id, this.href, 'get', 0);" class="d_d50" ><!--{if $kunum != 0}--><img src="images/zhong_21.jpg" width="102" height="25" align="top" border="0" /><!--{else}--><img src="images/ys.png" width="102" height="25" align="top" border="0" /><!--{/if}--></a></td>
                      </tr>
                    </table></td>
                  </tr>
                </table></td>
				<!--{if $hh % 60 == 0}--> <!--{elseif $hh % 4 == 0}--></tr><tr><!--{/if}-->
				<!--{eval $hh++;}-->
				<!--{/loop}-->
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
if(empty($_GET['mod']) || !in_array($_GET['mod'], array('ajaxop','ceshi','zadan','gengduoniliao','hdzy','dianzan'))) {
	dheader('location:shop.php', '301');
}
 
$muban=$_GET['mb'];
if(!empty($muban)){
	/**
	食用说明:以后可直接更改下方array中的内容,内容名称直接代表模板名字
	mod参数已被指定,mb后面的参数是模板名称。
	链接格式:http://www.baidu.com/zhuanti.php?mod=hdzy&mb=muban  ↓↓↓↓
	**/
	if(empty($muban) || !in_array($muban, array('在这里添加模板名称','daimaceshi'))) {
	dheader('location:shop.php', '301');
	}
}

布施恩德可便相知重

微信扫一扫打赏

支付宝扫一扫打赏

×

给我留言