欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

帝國(guó)CMS根據(jù)內(nèi)容正文字段[newstext]批量獲取描述簡(jiǎn)介字段[smalltext]的方法

  發(fā)布時(shí)間:2023-06-26 12:01:49   作者:Moyu   我要評(píng)論
這篇文章主要介紹了帝國(guó)CMS根據(jù)內(nèi)容正文字段[newstext]批量重新生成簡(jiǎn)介字段[smalltext]的方法,需要的朋友可以參考下

問(wèn):

帝國(guó)CMS已經(jīng)發(fā)布的信息,我想批量的根據(jù)新聞?wù)闹匦芦@取簡(jiǎn)介應(yīng)該怎么處理?

最好能定義獲取多少字符,方便重新整理簡(jiǎn)介

功能要求:批量從信息的新聞?wù)淖侄卫铽@取自定字?jǐn)?shù)的文字到簡(jiǎn)介字段!

解決方案

一、首先重新按需設(shè)置自動(dòng)生成簡(jiǎn)介的字?jǐn)?shù),帝國(guó)CMS默認(rèn)自動(dòng)獲取簡(jiǎn)介的字?jǐn)?shù)可以從下圖方式更改,我這里為了方便演示改成了320,默認(rèn)為160,這里的數(shù)字,2個(gè)字符代表一個(gè)漢字,一個(gè)字符為一個(gè)英文。

帝國(guó)CMS根據(jù)新聞?wù)淖侄蝃newstext]批量重新生成簡(jiǎn)介字段[smalltext]的方法

這步做完,新發(fā)的信息,默認(rèn)截取簡(jiǎn)介字?jǐn)?shù)就變成了新設(shè)置的字?jǐn)?shù)了!已經(jīng)發(fā)布的信息的處理方法請(qǐng)繼續(xù)往下看!

二、寫(xiě)一個(gè)處理PHP,名字叫auto_smalltext.php,懶得寫(xiě)的,后面提供了下載地址了,直接下載使用也可以。

PHP的內(nèi)容:

<?php
define('EmpireCMSAdmin','1');
require("../class/connect.php");
require("../class/db_sql.php");
require("../class/functions.php");
require("../class/t_functions.php");
require("../data/dbcache/class.php");
require("../data/language/gb/pub/fun.php");
$link=db_connect();
$empire=new mysqlquery();
$tbname='news';//數(shù)據(jù)表名稱
$quantity=320;//重新生成簡(jiǎn)介字?jǐn)?shù):320代表320個(gè)英文,160個(gè)漢字!
$query="select * from {$dbtbpre}ecms_".$tbname." order by id desc";
$sql=$empire->query($query);
while($r=$empire->fetch($sql))
{
$rb=$empire->fetch1("select newstext from {$dbtbpre}ecms_".$tbname."_data_".$r[stb]." where id='".$r[id]."' limit 1");
$newstext=$rb[newstext];
$smalltext=strip_tags($newstext);
$smalltext=esub($smalltext,$quantity);
$empire->query("update {$dbtbpre}ecms_".$tbname." set smalltext='$smalltext' where id='$r[id]'");
}
echo '執(zhí)行完畢';
db_close();
$empire=null;
?>

把PHP放到/e/extend/ 目錄下!

auto_smalltext.php下載.rar (620 Bytes)

三、按需調(diào)整PHP文件里的數(shù)據(jù)表名字和簡(jiǎn)介字?jǐn)?shù)。

四、備份你的數(shù)據(jù)庫(kù),防止出錯(cuò).

五、瀏覽器運(yùn)行  你的域名/e/extend/auto_smalltext.php

完成!

下面放幾張對(duì)比圖吧

模板調(diào)用簡(jiǎn)介,調(diào)整前效果

帝國(guó)CMS根據(jù)新聞?wù)淖侄蝃newstext]批量重新生成簡(jiǎn)介字段[smalltext]的方法

模板調(diào)用簡(jiǎn)介,調(diào)整后效果

帝國(guó)CMS根據(jù)新聞?wù)淖侄蝃newstext]批量重新生成簡(jiǎn)介字段[smalltext]的方法

后臺(tái)信息,調(diào)整前簡(jiǎn)介字?jǐn)?shù):

帝國(guó)CMS根據(jù)新聞?wù)淖侄蝃newstext]批量重新生成簡(jiǎn)介字段[smalltext]的方法

后臺(tái)信息,調(diào)整后簡(jiǎn)介字?jǐn)?shù):

帝國(guó)CMS根據(jù)新聞?wù)淖侄蝃newstext]批量重新生成簡(jiǎn)介字段[smalltext]的方法

到此這篇關(guān)于帝國(guó)CMS根據(jù)內(nèi)容正文字段[newstext]批量重新生成簡(jiǎn)介字段[smalltext]的方法的文章就介紹到這了,更多相關(guān)內(nèi)容正文批量生成簡(jiǎn)介字段內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持腳本之家!

相關(guān)文章

最新評(píng)論