zoukankan      html  css  js  c++  java
  • 更新上篇文章 调用三级目录文章内容 dede频道页实现三级栏目嵌套调用文章

    原文:http://www.wuaie.com/?p=66

    源码改写

    $typeid = $row['id'];

    if((class_exists('PartView')))

    {

    $pv = new PartView($typeid);

    $text = $likeType;

    $text= str_replace(array('{field', '/}'), array('[field', '/]'), $text);

    $pv->SetTemplet($text,'string');

    $artlist = $pv->GetResult();

    $likeType = $artlist;

    }

    在/include/taglib/channel.lib.php 中找到if($col>1) $likeType .= "</dd> ";   (v5.6 是125行 v5.7是156行)在这句话上面加上上面的代码

    解决前台问题:

    1.

      {dede:channelartlist}
           {dede:field name='typeurl'/}  {dede:field name='typename'/} //外框架
            {dede:channel type='sun'}//子框架
            <h3><a href="[field:typelink/]" target="_blank">[field:typename/]</a></h3>
            {dede:arclist row='5' titlelen='39'} //调用文章
          
            {field:arcurl/}        {field:title/}
            {/dede:arclist}
            {/dede:channel}
        {/dede:channelartlist}

    2.第二种方法没有尝试:

    调用代码

    前台模板中使用

    {dede:channelartlist}

    {dede:field name='typeurl'/}  {dede:field name='typename'/} //外框架

    {dede:channel type='sun'}//子框架

    <h3><a href="[field:typelink/]" target="_blank">[field:typename/]</a></h3>

    {dede:arclist row='5' titlelen='39'} //调用文章

    连接:  {field:arcurl/}

    标题: {field:title/}

    {/dede:arclist}

    {/dede:channel}

    {/dede:channelartlist}

    ----------------------------------------------------------------------------------------------------------------------

    有人反应 加了这代码之后 文章页有{dede:channel} {/dede:channel} 这个的时候更新不了

    于是可以看了下代码 可以改成这样

    if($sanji)
    {
    $typeid = $row['id'];

    if((class_exists('PartView')))

    {

    $pv = new PartView($typeid);

    $text = $likeType;

    $text= str_replace(array('{field', '/}'), array('[field', '/]'), $text);

    $pv->SetTemplet($text,'string');

    $artlist = $pv->GetResult();

    $likeType = $artlist;

    }
    }

    然后在channel.lib.php文件的开头 global $dsql; 的后面加上$sanji = $ctag->GetAtt('sanji');

    调用的时候变成

    {dede:channelartlist}

    {dede:field name='typeurl'/}  {dede:field name='typename'/} //外框架

    {dede:channel type='sun'  sanji='1'}//子框架

    <h3><a href="[field:typelink/]" target="_blank">[field:typename/]</a></h3>

    {dede:arclist row='5' titlelen='39'} //调用文章

    连接:  {field:arcurl/}

    标题: {field:title/}

    {/dede:arclist}

    {/dede:channel}

    {/dede:channelartlist}

    就可以解决问题了

  • 相关阅读:
    PHP多进程(四) 内部多进程
    STL map and multimap
    Understanding Function Objects
    Working with Bit Flags Using STL
    STL Algorithms
    STL set and multiset
    Understanding Smart Pointers
    More Effective C++ 学习笔记(1)
    Adaptive Container: stack and queue
    第一个 Python 程序
  • 原文地址:https://www.cnblogs.com/subtract/p/3284199.html
Copyright © 2011-2022 走看看