文件名称:phpcms_tag热门调用插件.zip
文件大小:39KB
文件格式:ZIP
更新时间:2023-05-20 05:04:55
phpcms_tag 热门调用插件 phpcms
phpcms_tag热门调用插件首先将压缩包解压以后将phpcms文件夹放到根目录覆盖原来的文件夹然后打开phpcms/model/content_model.class.php 找到if(!$isimport && $data['status']==99) {在他的上面添加如下代码 if($systeminfo['keywords']){ $this->db_tags = pc_base::load_model('tags_model'); //$this->db_tags_content = pc_base::load_model('tags_content_model'); $keywords = strpos($systeminfo['keywords'], ',') !== false ? explode(',', $systeminfo['keywords']) : explode(' ', $systeminfo['keywords']); $sql = ''; foreach($keywords as $key){ if($this->db_tags->get_one("`tag`='$key'", 'tagid')){ $this->db_tags->query("UPDATE `phpcms_tags` SET `usetimes`=usetimes+1 WHERE tag='$key'"); }else{ $this->db_tags->query("INSERT INTO `phpcms_tags`(`tag`,`usetimes`,`lastusetime`,`lasthittime`)VALUES('$key',1,".SYS_TIME.",".SYS_TIME.")"); } $sql .= ",('$key','$urls[0]','$systeminfo[title]',$this->siteid,$modelid,$id,$systeminfo[catid],".SYS_TIME.")\n"; } if($sql){ $sql = "INSERT INTO `phpcms_tags_content` (`tag`,`url`,`title`,`siteid`,`modelid`,`contentid`,`catid`,`updatetime`) VALUES ".substr($sql, 1); $this->db_tags->query($sql); } } 找到$this->content_check_db->update($check_data,array('checkid'=>'c-'.$id.'-'.$this->modelid)); 在他的下面添加如下代码 if($systeminfo['keywords']){ $this->db_tags = pc_base::load_model('tags_model'); $this->db_tags_content = pc_base::load_model('tags_content_model'); $keywords = strpos($systeminfo['keywords'], ',') !== false ? explode(',', $systeminfo['keywords']) : explode(' ', $systeminfo['keywords']); $sql = ''; foreach($keywords as $key){ if(!$this->db_tags_content->get_one("`tag`='$key' AND `contentid` = $id AND `catid` =$systeminfo[catid] ", 'contentid')){ if($this->db_tags->get_one("`tag`='$key'", 'tagid')){ $this->db_tags->query("UPDATE `phpcms_tags` SET `usetimes`=usetimes+1 WHERE tag='$key'"); }else{ $this->db_tags->query("INSERT INTO `phpcms_tags`(`tag`,`usetimes`,`lastusetime`,`lasthittime`)VALUES('$key',1,".SYS_TIME.",".SYS_TIME.")"); } $sql .= ",('$key','$urls[0]','$systeminfo[title]',$this->siteid,$this->modelid,$id,$systeminfo[catid],".SYS_TIME.")\n"; } } if($sql){ $sql = "INSERT INTO `phpcms_tags_content` (`tag`,`url`,`title`,`siteid`,`modelid`,`contentid`,`catid`,`updatetime`) VALUES ".substr($sql, 1); $this->db_tags->query($sql); } } // 添加到 tags 表结束 然后进入后台管理模块;可以看到TAG标签模块;点安装;再重建引索即可 最后再使用Get SQL语句就可以把热门标签调用出来了