找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 108|回复: 0

[cms教程] DEDE保存TAGS标签之InsertTags函数

[复制链接]

该用户从未签到

发表于 2020-6-16 15:38:58 | 显示全部楼层 |阅读模式

您需要 登录 才可以下载或查看,没有账号?立即注册

×
/**
         *  插入Tags
         *
         * @access    public
         * @param     string  $tag  tag标签
         * @param     int  $aid  文档AID
         * @return    void
         */
        if ( ! function_exists('InsertTags'))
        {
            function InsertTags($tag, $aid)
            {
                $tags = explode(',',$tag);
                foreach($tags as $tag)
                {
                    $tag = trim($tag);
                    if(isset($tag[20]) || $tag!=stripslashes($tag))
                    {
                        continue;
                    }
                    InsertOneTag($tag,$aid);
                }
            }
        }
         
        通过如下函数获取保存在表里的TAGS标签:
         
         
         
        /**
         *  获得某文档的所有tag
         *
         * @param     int     $aid  文档id
         * @return    string
         */
        if ( ! function_exists('GetTags'))
        {
            function GetTags($aid)
            {
                global $dsql;
                $tags = '';
                $query = "SELECT tag FROM `dede_taglist` WHERE aid='$aid' ";
                $dsql->Execute('tag',$query);
                while($row = $dsql->GetArray('tag'))
                {
                    $tags .= ($tags=='' ? $row['tag', : ','.$row['tag',);
                }
                return $tags;
            }
        }
         
        函数在/include/helpers/archive.helper.php中
回复

使用道具 举报

网站地图|页面地图|文字地图|Archiver|手机版|小黑屋|找资源 |网站地图

GMT+8, 2024-10-7 18:32

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表