小熊猫娃娃 發表於 2023-12-19 00:00:00

织梦dedecms v5.1升级sp1后不显示上一篇、下一篇问题的解决方法

<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        方法很简单,也是最懒的方法,把关键之处恢复为升级之前的,需要修改两处。</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        第一处:</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        修改dede/inc/inc_archives_functions.php</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        原为:</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
         </p>
<div class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
        <div class="right">
                <span><u>复制代码</u></span>
</div>
        代码如下:</div>
<div class="msgborder" id="phpcode7" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
        <br>
        //更新上下篇文章<br>
        if($cfg_up_prenext=='Y' &amp;&amp; !empty($typeid))<br>
        {<br>
        $preRow = $arc-&gt;dsql-&gt;GetOne("Select ID From `{$arc-&gt;MainTable}` where ID&lt;$aid And ID&gt;".($aid+10)." And arcrank&gt;-1 And typeid='$typeid' order by ID desc");<br>
        $nextRow = $arc-&gt;dsql-&gt;GetOne("Select ID From `{$arc-&gt;MainTable}` where ID&lt;$aid And ID&gt;".($aid-10)." And arcrank&gt;-1 And typeid='$typeid' order by ID asc");<br>
        if(is_array($preRow)){<br>
        $arc = new Archives($preRow['ID']);<br>
        $arc-&gt;MakeHtml();<br>
        }<br>
        if(is_array($nextRow)){<br>
        $arc = new Archives($nextRow['ID']);<br>
        $arc-&gt;MakeHtml();<br>
        }<br>
        }</div>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
         </p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        改为:</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
         </p>
<div class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
        <div class="right">
                <span><u>复制代码</u></span>
</div>
        代码如下:</div>
<div class="msgborder" id="phpcode8" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
        <br>
        //更新上下篇文章<br>
        if($cfg_up_prenext=='Y' &amp;&amp; !empty($typeid))<br>
        {<br>
        $preRow = $arc-&gt;dsql-&gt;GetOne("Select ID From `{$arc-&gt;MainTable}` where ID&lt;$aid And arcrank&gt;-1 And typeid='$typeid' order by ID desc");<br>
        $nextRow = $arc-&gt;dsql-&gt;GetOne("Select ID From `{$arc-&gt;MainTable}` where ID&lt;$aid And arcrank&gt;-1 And typeid='$typeid' order by ID asc");<br>
        if(is_array($preRow)){<br>
        $arc = new Archives($preRow['ID']);<br>
        $arc-&gt;MakeHtml();<br>
        }<br>
        if(is_array($nextRow)){<br>
        $arc = new Archives($nextRow['ID']);<br>
        $arc-&gt;MakeHtml();<br>
        }<br>
        }</div>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
         </p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        注释: 其实主要是修改了sql语句</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        原来的:</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
         </p>
<div class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
        <div class="right">
                <span><u>复制代码</u></span>
</div>
        代码如下:</div>
<div class="msgborder" id="phpcode9" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
        <br>
        $preRow = $arc-&gt;dsql-&gt;GetOne("Select ID From `{$arc-&gt;MainTable}` where ID&lt;$aid And ID&gt;".($aid+10)." And arcrank&gt;-1 And typeid='$typeid' order by ID desc");<br>
        $nextRow = $arc-&gt;dsql-&gt;GetOne("Select ID From `{$arc-&gt;MainTable}` where ID&lt;$aid And ID&gt;".($aid-10)." And arcrank&gt;-1 And typeid='$typeid' order by ID asc");</div>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
         </p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        现在的<br>
         </p>
<div class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
        <div class="right">
                <span><u>复制代码</u></span>
</div>
        代码如下:</div>
<div class="msgborder" id="phpcode10" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
        <br>
        $preRow = $arc-&gt;dsql-&gt;GetOne("Select ID From `{$arc-&gt;MainTable}` where ID&lt;$aid And arcrank&gt;-1 And typeid='$typeid' order by ID desc");<br>
        $nextRow = $arc-&gt;dsql-&gt;GetOne("Select ID From `{$arc-&gt;MainTable}` where ID&lt;$aid And arcrank&gt;-1 And typeid='$typeid' order by ID asc");</div>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
         </p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        就是将And ID&gt;".($aid+10)." 与And ID&gt;".($aid-10)." 去掉了,为什么id不能大于10呢。如果对于栏目比较多的,肯定不行</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        <br>
        第二处:</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        修改include/inc_archives_view.php</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        原为:</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
         </p>
<div class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
        <div class="right">
                <span><u>复制代码</u></span>
</div>
        代码如下:</div>
<div class="msgborder" id="phpcode11" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
        <br>
        //--------------------------<br>
        //获取上一篇,下一篇链接<br>
        //--------------------------<br>
        function GetPreNext($gtype='')<br>
        {<br>
        $rs = "";<br>
        if(count($this-&gt;PreNext)&lt;2)<br>
        {&lt;/p&gt; &lt;p&gt; $aid = $this-&gt;ArcID;<br>
        $idmax = $this-&gt;ArcID+10;<br>
        $idmin = $this-&gt;ArcID-10;<br>
        $next = " arc.ID&gt;'$aid' And arc.ID&lt;'$idmax' And arc.arcrank&gt;-1 And typeid='{$this-&gt;Fields['typeid']}' order by arc.ID asc ";<br>
        $pre = " arc.ID&gt;'$idmin' And arc.ID&lt;'$aid' And arc.arcrank&gt;-1 And typeid='{$this-&gt;Fields['typeid']}' order by arc.ID desc ";<br>
        $query = "Select arc.ID,arc.title,arc.shorttitle,<br>
        arc.typeid,arc.ismake,arc.senddate,arc.arcrank,arc.money,<br>
        t.typedir,t.typename,t.namerule,t.namerule2,t.ispart,<br>
        t.moresite,t.siteurl<br>
        from `{$this-&gt;MainTable}` arc left join dede_arctype t on arc.typeid=t.ID<br>
        where ";<br>
        $nextRow = $this-&gt;dsql-&gt;GetOne($query.$next);<br>
        $preRow = $this-&gt;dsql-&gt;GetOne($query.$pre);<br>
        if(is_array($preRow))<br>
        {<br>
        $mlink = GetFileUrl($preRow['ID'],$preRow['typeid'],$preRow['senddate'],$preRow['title'],$preRow['ismake'],$preRow['arcrank'],$preRow['namerule'],$preRow['typedir'],$preRow['money'],true,$preRow['siteurl']);<br>
        $this-&gt;PreNext['pre'] = "上一篇:&lt;a href='$mlink' target='_blank'&gt;{$preRow['title']}&lt;/a&gt; ";<br>
        }<br>
        else{<br>
        $this-&gt;PreNext['pre'] = "上一篇:没有了 ";<br>
        }<br>
        if(is_array($nextRow))<br>
        {<br>
        $mlink = GetFileUrl($nextRow['ID'],$nextRow['typeid'],$nextRow['senddate'],$nextRow['title'],$nextRow['ismake'],$nextRow['arcrank'],$nextRow['namerule'],$nextRow['typedir'],$nextRow['money'],true,$nextRow['siteurl']);<br>
        $this-&gt;PreNext['next'] = "下一篇:&lt;a href='$mlink' target='_blank'&gt;{$nextRow['title']}&lt;/a&gt; ";<br>
        }<br>
        else{<br>
        $this-&gt;PreNext['next'] = "下一篇:没有了 ";<br>
        }<br>
        }&lt;/p&gt; &lt;p&gt; if($gtype=='pre'){<br>
        $rs = $this-&gt;PreNext['pre'];<br>
        }<br>
        else if($gtype=='next'){<br>
        $rs = $this-&gt;PreNext['next'];<br>
        }<br>
        else{<br>
        $rs = $this-&gt;PreNext['pre']." &amp;nbsp; ".$this-&gt;PreNext['next'];<br>
        }&lt;/p&gt; &lt;p&gt; return $rs;<br>
        }</div>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
         </p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        改为:</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
         </p>
<div class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
        <div class="right">
                <span><u>复制代码</u></span>
</div>
        代码如下:</div>
<div class="msgborder" id="phpcode12" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
        <br>
        //--------------------------<br>
        //获取上一篇,下一篇链接<br>
        //--------------------------<br>
        function GetPreNext($gtype='')<br>
        {<br>
        $rs = "";<br>
        if(count($this-&gt;PreNext)&lt;2)<br>
        {&lt;/p&gt; &lt;p&gt; $aid = $this-&gt;ArcID;<br>
        $idmax = $this-&gt;ArcID+10;<br>
        $idmin = $this-&gt;ArcID-10;<br>
        $next = " arc.ID&gt;'$aid' And arc.arcrank&gt;-1 And typeid='{$this-&gt;Fields['typeid']}' order by arc.ID asc ";<br>
        $pre = " arc.ID&lt;'$aid' And arc.arcrank&gt;-1 And typeid='{$this-&gt;Fields['typeid']}' order by arc.ID desc ";<br>
        $query = "Select arc.ID,arc.title,arc.shorttitle,<br>
        arc.typeid,arc.ismake,arc.senddate,arc.arcrank,arc.money,<br>
        t.typedir,t.typename,t.namerule,t.namerule2,t.ispart,<br>
        t.moresite,t.siteurl<br>
        from `{$this-&gt;MainTable}` arc left join dede_arctype t on arc.typeid=t.ID<br>
        where ";<br>
        $nextRow = $this-&gt;dsql-&gt;GetOne($query.$next);<br>
        $preRow = $this-&gt;dsql-&gt;GetOne($query.$pre);<br>
        if(is_array($preRow))<br>
        {<br>
        $mlink = GetFileUrl($preRow['ID'],$preRow['typeid'],$preRow['senddate'],$preRow['title'],$preRow['ismake'],$preRow['arcrank'],$preRow['namerule'],$preRow['typedir'],$preRow['money'],true,$preRow['siteurl']);<br>
        $this-&gt;PreNext['pre'] = "上一篇:&lt;a href='$mlink' target='_blank'&gt;{$preRow['title']}&lt;/a&gt; ";<br>
        }<br>
        else{<br>
        $this-&gt;PreNext['pre'] = "上一篇:没有了 ";<br>
        }<br>
        if(is_array($nextRow))<br>
        {<br>
        $mlink = GetFileUrl($nextRow['ID'],$nextRow['typeid'],$nextRow['senddate'],$nextRow['title'],$nextRow['ismake'],$nextRow['arcrank'],$nextRow['namerule'],$nextRow['typedir'],$nextRow['money'],true,$nextRow['siteurl']);<br>
        $this-&gt;PreNext['next'] = "下一篇:&lt;a href='$mlink' target='_blank'&gt;{$nextRow['title']}&lt;/a&gt; ";<br>
        }<br>
        else{<br>
        $this-&gt;PreNext['next'] = "下一篇:没有了 ";<br>
        }<br>
        }&lt;/p&gt; &lt;p&gt; if($gtype=='pre'){<br>
        $rs = $this-&gt;PreNext['pre'];<br>
        }<br>
        else if($gtype=='next'){<br>
        $rs = $this-&gt;PreNext['next'];<br>
        }<br>
        else{<br>
        $rs = $this-&gt;PreNext['pre']." &amp;nbsp; ".$this-&gt;PreNext['next'];<br>
        }&lt;/p&gt; &lt;p&gt; return $rs;<br>
        }</div>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
         </p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        改好的文件覆盖上传即可。</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        当然这里也是修改的sql语句</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
         </p>
<div class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
        <div class="right">
                <span><u>复制代码</u></span>
</div>
        代码如下:</div>
<div class="msgborder" id="phpcode13" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
        <br>
        $next = " arc.ID&gt;'$aid' And arc.arcrank&gt;-1 And typeid='{$this-&gt;Fields['typeid']}' order by arc.ID asc ";<br>
        $pre = " arc.ID&lt;'$aid' And arc.arcrank&gt;-1 And typeid='{$this-&gt;Fields['typeid']}' order by arc.ID desc ";</div>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
         </p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        因为可能版本不同,不建议直接全部复制,只需要替换下sql语句即可。要不容易出现错误。</p>
頁: [1]
查看完整版本: 织梦dedecms v5.1升级sp1后不显示上一篇、下一篇问题的解决方法