The method by which Imperial CMS gets the description profile field [smalltext] in bulk based on the content body field [newstext]

Post: 2023-06-26 12:01:49 Author: Moyu I want to comment
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 need

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.

帝国CMS根据新闻正文字段[newstext]批量重新生成简介字段[smalltext]的方法

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

帝国CMS根据新闻正文字段[newstext]批量重新生成简介字段[smalltext]的方法

Template call introduction, adjusted effect

帝国CMS根据新闻正文字段[newstext]批量重新生成简介字段[smalltext]的方法

Background information, introduction before adjustment Word count:

帝国CMS根据新闻正文字段[newstext]批量重新生成简介字段[smalltext]的方法

Background information, adjusted introduction Word count:

帝国CMS根据新闻正文字段[newstext]批量重新生成简介字段[smalltext]的方法

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!

  • Tag: The introduction field generates content bodies in batches

Related article

Latest comments