Hongmu Notes
Home Program Notes pbootcms randomly calls articles with high efficiency (not adding rand() to database query)!
Program Notes PbootCms

pbootcms randomly calls articles with high efficiency (not adding rand() to database query)!

pbootcms randomly calls articles with high efficiency (not adding rand() to database query)!

pbootcms is okay, but the calling method is a bit lacking!

I originally wanted to call the article randomly, but I only found random calls. However, this kind of database query sorting is very performance-intensive!

Thousands of articles are fine, but tens of thousands or hundreds of thousands of articles, then just wait for it to lag!

So I did some research and found that pbootcms supports php tags, which is great!

So the calling method that comes with php+, the combination of the two produced the legendary, high-efficiency random calling!

calling code

 隐藏内容:评论后查看
<?php for($i=0;$i<10;$i++){?>
{pboot:content id=<?=mt_rand(1,1342)?>}
	<li>
		<article class="list_layout">
			<a href="[content:link]" class="thumbs" data-type="mip" data-title="[content:title]" title='[content:title]'>
			<mip-img layout="container" alt='[content:title]' src="[content:ico]"></mip-img>
			</a>
			<h3><a href="[content:link]" title="[content:title]">[content:title]</a></h3>
			<div class="info">
				<span class="category"><a target="_blank" href="[content:sortlink]">[content:sortname]</a></span>
				<span class="date">[content:date style=Y-m-d]</span><span class="view"><i class="icon icon-eye-1"></i><b>[content:visits]</b></span>
			</div>
		</article>
	</li>
	{/pboot:content}
	<?php }?>

 

微信赞赏

WeChat

支付宝赞赏

Alipay

✍️ Author: Hong Mu

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

Author homepage View home page →

Related articles

Addition of message function to pbootcms website

Addition of message function to pbootcms website Program Notes PbootCms

Scope of application of message board tags: can be used anywhere on the entire site Tag function: used for users to submit messages and retrieve message records 1. Message submission form<form action="{pboot:msgaction}" method="post"> Contact person:<input type="tex…
👁 174
pbootcms introduces public file code

pbootcms introduces public file code Program Notes PbootCms

1. Template file nested reference {include file=***.html} Instructions for use: It can be used nested, such as: index.html nests a head.html, and nested comm.html in head.html supports the use of subdirectories, such as: {include file=comm/*.html} 2. Time formatting tag style=*, such as: within...
👁 235

Recommended reading

Information Blog News Network Website Template 0790

Information Blog News Network Website Template 0790 Practical Collection Yiyou template

This set of eyoucms templates is suitable for information, blogs and news networks. It has a design style information flow and is suitable for aggregating various news information, industry trends, in-depth reports and hot topics. Helps comprehensive information websites attract readers online. Template display Installation instructions Website backend: /login.php Account: admin Password: admin Related articles Summary of common problems in Eyou CMS installation Eyou CMS (EyouCms…
👁 46
Computer operating system software download website template 0147

Computer operating system software download website template 0147 Practical Collection Yiyou template

This set of eyoucms templates is suitable for computer operating systems and software download websites. The design style is simple and practical, and can display operating systems, software applications, download resources and technical tutorials. Helps software download sites attract user traffic online. Template display Installation instructions Website backend: /login.php Account: admin Password: admin Related articles Summary of common problems in Eyou CMS installation Eyou CMS (Eyou…
👁 53
(Adaptive Mobile Version) HTML5 Blue Wide-Screen Clean & Eco-Friendly Tech Energy pbootCMS Corporate Website Template – Responsive Blue Group General Website Source Code Download: 0690

(Adaptive Mobile Version) HTML5 Blue Wide-Screen Clean & Eco-Friendly Tech Energy pbootCMS Corporate Website Template – Responsive Blue Group General Website Source Code Download: 0690 Practical Collection pbootcms Template

A blue widescreen eco-friendly technology-based PbootCMS corporate template featuring responsive design. Its modern, tech-driven aesthetic makes it ideal for showcasing a company's brand identity or business segments in the environmental energy sector or for corporate groups. It is an excellent choice for businesses looking to create an international, high-tech branded official website. Template Preview | Installation Instructions | Website Backend: /admin.php | Username: admin | Password: admin | Extraction Password: www.4s5.cn | Related Articles...
👁 40
(PC+WAP) Environmental New Materials Technology – pbootCMS Website Template Download (0066)

(PC+WAP) Environmental New Materials Technology – pbootCMS Website Template Download (0066) Practical Collection pbootcms Template

A PbootCMS website template designed for environmental protection new materials technology companies, supporting both PC and mobile access. It features a modern, minimalist design that highlights technological innovation and environmental sustainability. This template is ideal for new materials enterprises seeking to establish an industry-leading brand image; it effectively showcases innovative eco-friendly materials, R&D achievements, and corporate strength. Template Display | Installation Instructions | Website Backend: /admin.php | Username: admin | Password: ad...
👁 50
Python reported an error. What is the reason? AttributeError: partially initialized module ' openai'  has no attribute ' Completion' (most likely due to a circular import)

Python reported an error. What is the reason? AttributeError: partially initialized module ' openai' has no attribute ' Completion' (most likely due to a circular import) Language Notes python

This error prompt indicates that there is a problem when importing the openai module and the specific Completion attribute, which is probably caused by circular import. The reason for this error may be that two or more modules in your code are imported from each other, forming a circular dependency. For example, module A imports module B, and module B imports module A.. Cyclic import will cause the module not to initialize correctly when loading, thus …
👁 656
Responsive shelving and container website template – 0791

Responsive shelving and container website template – 0791 Practical Collection Yiyou template

An eyouCMS responsive website template designed for the shelving and container storage industry. Its professional and practical design enables effective presentation of shelving products, container storage solutions, warehousing solutions, and project case studies. This template helps warehousing equipment manufacturers showcase their products online and attract retail and logistics clients. Template Overview | Installation Instructions | Website Backend: /login.php | Username: admin | Password: admin | Related Articles: Summary of Common Installation Issues for YououCMS...
👁 57