wrjc1hod 发表于 2024-10-10 03:47:40

Fastadmin CMS伪静态时面包屑导航网址不正确的应急处理


    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">这个fastadmin cms项目伪静态的规则是一级栏目对应两级目录,即<span style="color: black;">如栏目自定义URL名<span style="color: black;">叫作</span>为“abc”,<span style="color: black;">那样</span>内容页123默认的伪静态是路径是“/abc/123”,而这个项目的自定义伪静态为“/abc/bcd/123”。伪静态后网站浏览正常,排除伪静态问题,这就只能是面包屑的问题了。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">fastadmin cms官方只对购买者<span style="color: black;">自己</span>开放技术支持,网上的资料非常少。这是个半道接的debug项目,<span style="color: black;">基本</span>不可能去找购买者查资料。<span style="color: black;">由于</span>时间又不<span style="color: black;">准许</span>仔细琢磨,模块里面尝试修改<span style="color: black;">无</span>效果,于是直接在模版里面下手了。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">经过尝试<span style="color: black;">能够</span><span style="color: black;">经过</span>{$__CHANNEL__.parent_id}标签获取到当前栏目的父目录的id,<span style="color: black;">经过</span>{cms:channellist id="channel" type="brother" typeid="$parentid" }标签<span style="color: black;">得到</span>父目录的同级目录名<span style="color: black;">叫作</span>和网址,<span style="color: black;">因此呢</span><span style="color: black;">能够</span>逐级取得父目录的信息。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">在模版文件中直接<span style="color: black;">插进</span>php代码,<span style="color: black;">尽可能</span><span style="color: black;">运用</span>系统<span style="color: black;">供给</span>的现成数据,不进行后端操作。</p>{php}
    <span style="color: black;">$str</span> = ;
    <span style="color: black;">$parentid</span>=<span style="color: black;">$__CHANNEL__</span>[<span style="color: black;">parent_id</span>];//<span style="color: black;">$__CHANNEL__</span>[<span style="color: black;">parent_id</span>]对应标签{<span style="color: black;">$__CHANNEL__</span>.parent_id}
    <span style="color: black;">while</span> (<span style="color: black;">$parentid</span>!=0){
    {/php}
    {cms:channellist id=<span style="color: black;">"channel"</span> <span style="color: black;">type</span>=<span style="color: black;">"brother"</span> typeid=<span style="color: black;">"<span style="color: black;">$parentid</span>"</span> }
    {php}
    <span style="color: black;">if</span> (<span style="color: black;">$channel</span>[<span style="color: black;">id</span>]===<span style="color: black;">$parentid</span>){//<span style="color: black;">$channel</span>[<span style="color: black;">id</span>]对应标签{cms:channel name=<span style="color: black;">"id"</span> /},
    <span style="color: black;">$str</span>.=<span style="color: black;">&lt;a href="</span>.<span style="color: black;">$channel</span>[<span style="color: black;">url</span>].<span style="color: black;">"&gt;</span>.<span style="color: black;">$channel</span>[<span style="color: black;">name</span>].<span style="color: black;">&lt;/a&gt; &gt;&gt; </span>;//<span style="color: black;">$channel</span>[<span style="color: black;">url</span>]对应标签{cms:channel name=<span style="color: black;">"url"</span> /};<span style="color: black;">$channel</span>[<span style="color: black;">name</span>]对应标签{cms:channel name=<span style="color: black;">"name"</span> /}
    <span style="color: black;">$parentid</span>=<span style="color: black;">$channel</span>[<span style="color: black;">parent_id</span>];//<span style="color: black;">$channel</span>[<span style="color: black;">parent_id</span>]对应标签{cms:channel name=<span style="color: black;">"parent_id"</span> /}
    }
    {/php}
    {/cms:channellist}
    {php}
    }
    <span style="color: black;">echo</span> <span style="color: black;">$str</span>;
    {/php}
    &lt;a href=<span style="color: black;">"{<span style="color: black;">$__CHANNEL__</span>.url}"</span>&gt;{<span style="color: black;">$__CHANNEL__</span>.name}&lt;/a&gt;&lt;!--当前目录--&gt;
    {<span style="color: black;">$__ARCHIVES__</span>.title}&lt;!--当前<span style="color: black;">文案</span>--&gt;<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">这儿</span>对父目录的类型<span style="color: black;">无</span>做<span style="color: black;">需求</span>,<span style="color: black;">倘若</span>需要<span style="color: black;">能够</span><span style="color: black;">运用</span>$channel来进行判断。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">以后有时间再慢慢琢磨相应模块。</p>




4zhvml8 发表于 2024-10-20 14:55:24

在遇到你之前,我对人世间是否有真正的圣人是怀疑的。

m5k1umn 发表于 2024-11-5 08:14:31

你字句如珍珠,我珍藏这份情。

qzmjef 发表于 2024-11-6 15:28:24

祝福你、祝你幸福、早日实现等。
页: [1]
查看完整版本: Fastadmin CMS伪静态时面包屑导航网址不正确的应急处理