The method by which Imperial CMS gets the description profile field [smalltext] in bulk based on the content body field [newstext]
Question:
Imperial CMS has published the information, I want to batch according to the news text to get the profile again, what should I do?
It is a good idea to define how many characters to get so that you can rearrange the brief
Function requirements: Batch from the information of the news body field to obtain a customized word length of text to the introduction field!
solution
The number of words automatically obtained by CMS can be changed from the following figure. For the convenience of demonstration, I have changed it to 320, and the default is 160. The number here, 2 characters represent a Chinese character, and one character is an English character.
After this step is done, the new message, the default interception of the profile word will become the new set of words! How to handle the information that has been published please read on!
Second, write a processing PHP, the name is auto_smalltext.php, lazy to write, the following provides the download address, direct download can also be used.
PHP content:
<? 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'; // Table name $quantity=320; // Re-generate the introduction Word count: 320 represents 320 English, 160 Chinese characters! $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 'done '; db_close(); $empire=null; ? >
Put PHP in the /e/extend/ directory!
auto_smalltext.php Download.rar (620 Bytes)
Adjust the data table name and introduction word count in the PHP file as needed.
Back up your database to prevent errors.
5. Run your browser with your domain name /e/extend/auto_smalltext.php
Done!
Let me show you some comparison pictures
Template call introduction, adjustment before the effect
Template call introduction, adjusted effect
Background information, introduction before adjustment Word count:
Background information, adjusted introduction Word count:
This is the end of this article about the method of Empire CMS batch re-generating the profile field [smalltext] based on the content body field [newstext]. For more information about the content body batch generating the profile field content, please search previous articles of Script House or continue to browse the related articles below. I hope you will support the script House in the future!
Related article
-
This article mainly introduces the method of Empire CMS batch re-generating the introduction field [smalltext] according to the content text field [newstext], which can be referred to by friends in need2023-06-26
-
Empire cms7.2 version began to add King Kong mode, login release is difficult. The Imperial CMS 7.2/7.5 available for pro testing with a log-in free press release module plug-in coupled with a train collector can solve such problems. Be perfect2022-04-21
-
Empire cms development should pay attention to some dangerous injection vulnerabilities, prevent being hacked,RepPIntvar for the system's own function can play a role in filtering characters, the following is to introduce the use of2021-07-26
-
Imperial cms background enables SESSION authentication for increased security
Imperial cms background enables SESSION to verify that all login information is saved on the server side, especially in public places where the default cookies are not secure2021-07-26 -
Detailed step-by-step method for upgrading Imperial CMS7.2 to 7.5 (tested)
Recently need to upgrade the old version of Empire cms 7.2 to 7.5 version, refer to this article perfect upgrade, and share it for the need of friends2020-08-02 -
Imperial cms common tag call method (smart tag and universal tag call method)
Some common Empire CMS calls, smart label and universal label call method examples are organized, including slide, title, first level column, second level column, friendship link with template (drop-down menu), how to call when the content page field is empty2020-02-04 -
Empire cms sitemap sitemap.xml production method
This article mainly introduces the empire cms website map sitemap.xml production method, the need of friends can refer to2020-02-04 -
Imperial CMS Data Update Center Setup tutorial (update website details)
When using Imperial cms, it is sometimes necessary to update the foreground data, so you can refer to the following article, or you will not miss the part to achieve the purpose of updating2020-02-04 -
Imperial CMS background login interface and background interface modification method
Today received a netizan to ask how to modify the background login interface and background interface, special method to share out the need of friends can refer to it2020-02-04 -
Empire cms7.5 online form submission production method
Recently, the imitation station team received a lot of imitation station customer orders, which has such a function, form submission, spend time today to write a tutorial to everyone, need friends can refer to it2020-02-02
Latest comments