zoukankan      html  css  js  c++  java
  • 织梦首页/列表页/内容页直接获取软件模型本地下载地址

    当使用软件模型而且只有一个下载地址时,我们都喜欢用本地地址,在列表页时直接输出这个地址,方便访客下载。

    打开 /include/extend.func.php 在文件最下面添加个方法

    /**
     *  获取软件模型本地地址
     *
     * @access    public
     * @param     string  $aid  	文章id
     * @return    string
     */
    if (!function_exists('GetDownLink'))
    {
        function GetDownLink($aid)
        {
           global $dsql;
           $row= $dsql->GetOne("SELECT softlinks FROM `#@_addonsoft` WHERE aid = {$aid}");
               if(!is_array($row)){
                return '';
                }
               else{
                $dtp = new DedeTagParse();
                $dtp->LoadSource($row['softlinks']);
                    foreach($dtp->CTags as $ctag)
                    {
                        if($ctag->GetName()=='link')
                    {
                        $link = trim($ctag->GetInnerText());
                    }
                }
           }
           return  $link;
        }
    }

    前台模板中调用标签写法

    首页/列表页

    [field:id function=GetDownLink(@me)/]

    内容页

    {dede:field.id function=GetDownLink(@me)/}
  • 相关阅读:
    SpringDataJpa实体类常用注解
    I2C子系统
    input子系统
    platform深入
    运用层是怎样找到驱动的+open中子设备识别
    misc设备
    文章标题
    uboot2015第一阶段---SPL
    git工具使用
    Andriod底层第五课------HAL硬件抽象层
  • 原文地址:https://www.cnblogs.com/dedehtml/p/9902797.html
Copyright © 2011-2022 走看看