Hongmu Notes
Home Program Notes Empire cms, insert a picture in the first paragraph of the article
Program Notes Empire cms

Empire cms, insert a picture in the first paragraph of the article

Empire cms, insert a picture in the first paragraph of the article
<?php
$img = '<p><img src="/skin/images/'.mt_rand(1,1).'.png" alt="'.$navinfor['title'].'"></p>';
$pos = strpos($navinfor['newstext'], "</p>");
if ($pos === false) {
    echo  $navinfor['newstext'];
}
echo substr_replace($navinfor['newstext'], "</p>{$img}", $pos, strlen("</p>"));    
?>

In the content page, replace the article tag with the code above
Then put the serial numbered png format pictures under /skin/images/, such as: 1.png, 2.png
Finally, modify mt_rand in the code according to the needs of your picture (the smallest picture serial number, the largest breakthrough serial number)

微信赞赏

WeChat

支付宝赞赏

Alipay

✍️ Author: Hong Mu

webmaster · Thanks for reading, stay tuned for more exciting content

Author homepage View home page →

Related articles

Empire CMS database statement & SQL statement format

Empire CMS database statement & SQL statement format Program Notes Empire cms

Introduction to Imperial CMS extended SQL program writing, basic examples of Imperial CMS database statements & SQL statement formats: Note: The following examples are based on placing PHP files in the system root directory. Example 1: Connect to MYSQL program. (a.php)<?php require('e/class/connect.php'); //Introduce database configuration files and public function files requ…
👁 351
Empire CMS obtains the system COOKIE variable function getcvar()

Empire CMS obtains the system COOKIE variable function getcvar() Program Notes Empire cms

Get the system COOKIE variable function syntax: getcvar($var,$ecms) Description: $var: is the variable name $ecms: 0 is to set the foreground COOKIE variable, 1 is to set the background COOKIE variable. This parameter can be omitted and defaults to 0. Usage example: getcvar('mlusername'), get the user name of the front-end login member getcvar('loginu...
👁 296
Empire CMS smart label call field collection

Empire CMS smart label call field collection Program Notes Empire cms

Collect and classify all fields that support smart tag calls into Empire CMS smart tags: [e:loop={column ID/topic ID, number of items displayed, operation type, only display pictures with titles, additional SQL conditions, display sorting}] Template code content [/e:loop] Calling time: <?=date('m-d',$bqr[newstime])?> <?=dat…
👁 3749

Recommended reading

Construction real estate engineering enterprise website template 0528

Construction real estate engineering enterprise website template 0528 Practical Collection Yiyou template

An eyoucms website template for construction, real estate and engineering companies. The design style is grand and steady, and can display construction engineering cases, real estate projects, corporate strength and brand image. It helps construction and real estate companies establish their brand image online and attract customers. Template display Installation instructions Website backend: /login.php Account: admin Password: admin Related articles Summary of common problems in Yiyou CMS installation Yiyou C...
👁 50
Furniture custom company enterprise website template 0529

Furniture custom company enterprise website template 0529 Practical Collection Yiyou template

This EyouCMS template is ideal for custom furniture companies, featuring a high-end, modern design style perfect for showcasing custom furniture products, design projects, brand stories, and service processes. It helps custom furniture brands attract homeowners online and enhance their brand image. Template Display | Installation Instructions | Website Backend: /login.php | Username: admin | Password: admin | Related Articles: Summary of Common Installation Issues for EyouCMS | EyouCMS (E...
👁 29
Creative Advertising Design & Production Company Website Template – 0530

Creative Advertising Design & Production Company Website Template – 0530 Practical Collection Yiyou template

An EyouCMS website template designed specifically for creative advertising design and production agencies. Its innovative visual design style is ideal for showcasing advertising design works, creative case studies, brand strategy initiatives, and service offerings. This template helps advertising agencies demonstrate their professional expertise online and attract brand clients. Template Display | Installation Instructions | Website Backend: /login.php | Username: admin | Password: admin | Related Articles: Summary of Common Installation Issues for EyouCMS | EyouCMS...
👁 57
Resource website typecho001 template

Resource website typecho001 template Program Notes Typecho

typecho001 template template please do not modify the folder name of this template. The folder name is: typecho001 1.4 Fix the js output problem on the article page 1.3 Fix the error prompt when the plug-in is not installed Optimize the list page code output 1.2 Fix the comment function and add a custom homepage title 1.1 Fix the comment reply asymmetry function Add a separate title setting function on the homepage Add the website favicon.ico icon Add one...
👁 198
Advertising Design and Production Company Website Template – 0531

Advertising Design and Production Company Website Template – 0531 Practical Collection Yiyou template

This EyouCMS template is ideal for advertising design and production agencies, featuring a professional visual design style perfect for showcasing design works, advertising campaigns, brand case studies, and corporate strength. It helps advertising agencies present their brands online and attract corporate clients. Template Overview | Installation Instructions | Website Backend: /login.php | Username: admin | Password: admin | Related Articles: Summary of Common Installation Issues for EyouCMS | EyouCMS (EyouC...
👁 49
Modification of typecho paging style

Modification of typecho paging style Program Notes Typecho

Sir, times have changed! Typecho is currently the most perfect solution, because Baidu can only see the code of fixed thinking. The actual generated HTML code is breathtakingly clean and fully customized, including adding classes to the li element, adding classes to the a element, adding classes to the previous page and next page, and removing the li tags that come with typecho to express more. I can even add some text to the content inside...
👁 517