织梦dede其他二次开发问题大全

1,织梦文章手机端访问PC地址,自动跳转手机端地址

D:\phpstudy_pro\WWW\scentzone\templets\demo32\news_view.htm,head前面添加js代码

<script type="text/javascript">
    if(/AppleWebKit.*Mobile/i.test(navigator.userAgent) || (/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent)) || (/Android|Windows Phone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)))
    {
        window.location.href="/m/view.php?aid={dede:field.id/}";
    }
</script>

2,一级分类页面调用二级分类时,可以调用content问题
【说明】织梦默认是不支持调用content的;需要修改底层php代码,在sql语句上增加content字段

D:\phpstudy_pro\WWW\scentzone2\include\taglib\channel.lib.php,86行
else if($type=='son')
{
    if($typeid==0) return '';
    $sql = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,content
      From `#@__arctype` WHERE reid='$typeid' And ishidden<>1 order by sortrank asc limit 0, $line ";
}
调用
{dede:channel type='son' row='10' currentstyle=""}
<div class="chanpin">
    <h3>[field:typename/]</h3>
    <div class="cont">[field:content/]</div>
</div>
{/dede:channel}

3,织梦详情页,js调用当前分类id,当前文章id;等其他变量

var typeid = "{dede:type} [field:ID /] {/dede:type}";
var aid = "{dede:field.id/}";

4,解决织梦dede:list文章按照权重weight排序的方法

(1)模板调用{dede:list row ='8' orderby='weight' orderway='asc'}
(2)修改php文件:D:\phpstudy_pro\WWW\scentzone2\include\arc.listview.class.php,
(2-1)768行附近,($orderby=="lastpost"),增加
else if($orderby=="weight")  { $ordersql = "  ORDER BY arc.weight $orderWay"; }
(2-2)808行,if(preg_match('/hot|click|lastpost/', $orderby)),
改为if(preg_match('/hot|click|lastpost|weight/', $orderby))

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

喜爱cpp

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值