Custom function solves the problem of html code appearing when intercepting characters in the introduction of empire cms

888u

Last update at :2024-03-14,Edit by888u

When Empire CMS publishes information, it will by default intercept the previous paragraph from the detailed content as an introduction, but sometimes it will intercept the HTML code, which is very unpleasant. This tutorial can solve it.

First add a custom function to the e/class/connect.php file, such as NoHTML(). This can be set however you like

//Remove HTML tags function NoHTML($string){ $string = preg_replace("']*?>.*?'si", "", $string);//Remove javascript $string = preg_replace("'<[\/\!]*?[^<>]*?>'si", "", $string); //Remove HTML tags $string = preg_replace("'([\r\n])[\s]+'", "", $string); //Remove whitespace characters $string = preg_replace("'&(quot|#34);'i", "", $string); //Replace HTML entities $string = preg_replace("'&(amp|#38);'i", "", $string); $string = preg_replace("'&(lt|#60);'i", "", $string); $string = preg_replace("'&(gt|#62);'i", "", $string); $string = preg_replace("'&(nbsp|#160);'i", "", $string); //The following are regular rules for blocking phone numbers $string= preg_replace('/(0[0-9]{2,3}[-]?[2-9])[0-9]{3,4}([0-9]{3}[- ]?[0-9]?)/i','$1****$2',$string);//Hide the middle four digits of the phone number $string = preg_replace('/(1[358]{1}[0-9])[0-9]{4}([0-9]{4})/i','$1****$2 ',$string);//Hide the middle four digits of the mobile phone number //Block phone number regular end return $string; }

Then go to the list content template and modify the code

$r[smalltext]=esub(NoHTML($r[smalltext]),200,'...'); $listtemp='
  • [!--title--]

    [!--smalltext- -]

  • ';

    This problem is solved, it's very simple.

    Recommended site searches: asp host space, cheapest cloud server, foreign php space, view ip, virtual host server, cpanel host, Hong Kong cn2 server, view ip address, free second-level domain name, Hong Kong host high defense

    Custom function solves the problem of html code appearing when intercepting characters in the introduction of empire cms

    All copyrights belong to 888u unless special state
    取消
    微信二维码
    微信二维码
    支付宝二维码