老井茶 發表於 2023-12-18 00:00:00

dede:field name=position去除最后一个大于符号

<span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>事情: </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>dede提供了面包屑的功能。但是最后面总会带一个'&gt;'符号。甚是烦人。目标干掉它。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>第一种解决方法: 1. 在系统参数里面修改这个符号。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>第二种解决方法: 2. 使用截子符,runphp操作(网上百度很多,遗憾是我没有试验成功)。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>第三种解决方法: 3. 修改底层代码。(我采用的这种,试验了,可以)。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>解决: </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>找到 include/typelink.class.php 文件。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>找到下面的方法。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><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>
        //获得某类目的链接列表 如:类目一&gt;&gt;类目二&gt;&gt; 这样的形式 <br>
        //islink 表示返回的列表是否带连接 <br>
        function GetPositionLink($islink=true) <br>
        { <br>
        $indexpage = "&lt;a href='".$this-&gt;indexUrl."'&gt;".$this-&gt;indexName."&lt;/a&gt;"; <br>
        if($this-&gt;valuePosition!="" &amp;&amp; $islink) <br>
        { <br>
        return $this-&gt;valuePosition; <br>
        } <br>
        else if($this-&gt;valuePositionName!="" &amp;&amp; !$islink) <br>
        { <br>
        return $this-&gt;valuePositionName; <br>
        } <br>
        else if($this-&gt;TypeID==0) <br>
        { <br>
        if($islink) <br>
        { <br>
        return $indexpage; <br>
        } <br>
        else <br>
        { <br>
        return "没指定分类!"; <br>
        } <br>
        } <br>
        else <br>
        { <br>
        if($islink) <br>
        { <br>
        $this-&gt;valuePosition = $this-&gt;GetOneTypeLink($this-&gt;TypeInfos); <br>
        if($this-&gt;TypeInfos['reid']!=0) <br>
        { <br>
        //调用递归逻辑 <br>
        $this-&gt;LogicGetPosition($this-&gt;TypeInfos['reid'],true); <br>
        } <br>
        $this-&gt;valuePosition = $indexpage.$this-&gt;SplitSymbol.$this-&gt;valuePosition; <br>
        return $this-&gt;valuePosition.$this-&gt;SplitSymbol; //需要修改这里..... <br>
        } <br>
        else <br>
        { <br>
        $this-&gt;valuePositionName = $this-&gt;TypeInfos['typename']; <br>
        if($this-&gt;TypeInfos['reid']!=0) <br>
        { <br>
        //调用递归逻辑 <br>
        $this-&gt;LogicGetPosition($this-&gt;TypeInfos['reid'],false); <br>
        } <br>
        return $this-&gt;valuePositionName; <br>
        } <br>
        } <br>
        } </div>
<br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>将上面的需要修改的行,改成这样即可: return $this-&gt;valuePosition; </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>5. 最终模板调用的{dede:field name='position'/}。 最终效果图如下: </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><img title="dede:field name=position去除最后一个大于符号" alt="dede:field name=position去除最后一个大于符号" src="https://zhuji.jb51.net/uploads/img/202305/9f2b3f6a1a950fefc231eb933ec80ff8.jpg" style="max-width:100%!important;height:auto!important;border: 1px solid rgb(204, 204, 204); vertical-align: middle; padding: 1px; overflow: hidden; max-width: 696px; font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px; width: 423px; height: 38px;'>
頁: [1]
查看完整版本: dede:field name=position去除最后一个大于符号