Hongmu Notes
Home Language Notes EmpireCMS – Using PHP to call navigation tags (Simple & Clear Version)
Language Notes PHP

EmpireCMS – Using PHP to call navigation tags (Simple & Clear Version)

EmpireCMS – Using PHP to call navigation tags (Simple & Clear Version)

I was using PHP to handle navigation, but since many of my users didn't know PHP, they frequently reached out to me with questions. As a result, I've revised the code; this time, I've separated the PHP logic from the HTML code.

ad1a1b7183100500

After separation, you can see that the code is now much clearer than before.Empire Navigation calls advanced php codeThis article provides a comparison – in fact, as long as you have a basic understanding of HTML, you can easily comprehend the modifications!

Here is the code:

 隐藏内容:登录后可查看
<?php
$sql=$empire->query("select classid,sonclass,classname,islast,islist from {$dbtbpre}enewsclass where bclassid=0 and showclass=0 order by myorder,myorder asc");
while($s=$empire->fetch($sql)){
$classurl=sys_ReturnBqClassname($s,9); 
$tclass="";
$fr=explode('|',$class_r[$GLOBALS[navclassid]][featherclass]);
$topbclassid=$fr[1]?$fr[1]:$GLOBALS[navclassid];
if($topbclassid==$s[classid]){
$tclass='current-menu-item';
}
?>
<li class="<?=$tclass?>" ><a href="<?=$classurl?>"><?=$s[classname]?></a>
<?php if($s[islast]==0){ ?>
<ul class="sub-menu">
<?php
$sql2=$empire->query("select classid,classname from {$dbtbpre}enewsclass where bclassid=$s[classid] and showclass=0 order by myorder,myorder asc");while($s2=$empire->fetch($sql2)){$classurl2=sys_ReturnBqClassname($s2,9); ?>
<li><a href="<?=$classurl2?>"><?=$s2[classname]?></a></li>
<?php } ?>
</ul>
<?php } ?>
</li>
<?php } ?>

微信赞赏

WeChat

支付宝赞赏

Alipay

✍️ Author: Hong Mu

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

Author homepage View home page →

Related articles

PHP ob function record

PHP ob function record Language Notes PHP

Usage of the following three functions ob_get_contents(); ob_end_clean(); ob_start(); You can use these functions to buffer local files and execute local script code. Use ob_start() to save the output code into the buffer, and the page will not be displayed; then use ob_get_contents to get the data in the buffer. o…
👁 141
PHP preg

PHP preg Language Notes PHP

The preg_match_all function is used to perform a global regular expression match. preg_match_all() Syntax int preg_match_all ( string $pattern , string $subject [, array &$matches [, int $flags = PREG…
👁 169
Detailed explanation of PHP ternary operator and if

Detailed explanation of PHP ternary operator and if Language Notes PHP

Ternary operator condition ? Result 1 : Result 2 Explanation: The position in front of the question mark is the condition for judgment. If the condition is met, the result is 1, and if it is not met, the result is 2. This article compares and explains the ternary operator and if...else... in detail. I hope it will be helpful to everyone. Today when I was revising my paper online, I encountered a statement that I couldn’t understand: $if_summary = $row['IF_SUMMARY']=…
👁 189
PHP cast type

PHP cast type Language Notes PHP PHP collection PHP and mysql

Get the data type 1. If you want to check the value and type of an expression, use var_dump(). 2. If you just want to get an easy-to-read type expression for debugging, use gettype(). 3. To check a certain type, do not use gettype(), but use the is_type() function. Converting Strings to Numbers When a string is evaluated as a number, the result is determined according to the following rules...
👁 232

Recommended reading

Firefox web development and debugging enable forced refresh cache mode

Firefox web development and debugging enable forced refresh cache mode Summary of pitfalls

Clearing the cache in Fox Browser can be tricky; using shortcuts like Ctrl+F5 or Ctrl+R doesn't work in Google Chrome or Internet Explorer. Clearing the cache in Firefox is also quite cumbersome—the default shortcut (Ctrl+Shift+Del) opens a pop-up window for selective cleanup, requiring additional clicks to confirm; this is very inconvenient and not ideal for web development and debugging. To disable local caching in Firefox, you need to go to its Preferences and configure the settings accordingly: Firefox Browser...
👁 322
(Adaptive mobile version) PBootCMS template for battery-powered energy-related websites; Source code download for energy technology product websites – 0397

(Adaptive mobile version) PBootCMS template for battery-powered energy-related websites; Source code download for energy technology product websites – 0397 Practical Collection pbootcms Template

This set includes an adaptive mobile-friendly battery and energy technology product website template for the PbootCMS platform. The design features a modern, industrial aesthetic, making it ideal for showcasing battery and energy storage products as well as energy solutions. It enables new energy enterprises to present their products online and attract customers from the power and telecommunications industries. Template Overview | Installation Instructions | Website Backend: /admin.php | Username: admin | Password: admin | Extraction Password: www.4s5.cn – Related...
👁 41
(PC+WAP) Smart Access Control System Website Template – Download Face Recognition Gate Machine Website Source Code – 1127

(PC+WAP) Smart Access Control System Website Template – Download Face Recognition Gate Machine Website Source Code – 1127 Practical Collection pbootcms Template

An intelligent access control system and a PbootCMS website template for facial recognition gates – compatible with both PC and WAP devices. The modern, tech-driven design is ideal for showcasing access control systems, facial recognition devices, and security solutions. It enables smart security companies to showcase their products online and attract property management and commercial clients. Template Display | Installation Instructions | Website Backend: /admin.php | Username: admin | Password: admin | Extraction Password: www.4s...
👁 69
Responsive Pet Gear Website Template 0708

Responsive Pet Gear Website Template 0708 Practical Collection Yiyou template

An eyouCMS responsive website template designed for the pet gear and products industry. Its warm and charming design is perfect for showcasing pet supplies, pet equipment, brand stories, and pet care knowledge. This template helps pet brands showcase their products online and attract pet owners. Template Overview | Installation Instructions | Website Backend: /login.php | Username: admin | Password: admin | Related Articles: Summary of Common Installation Issues for YouYouCMS | YouYouCMS...
👁 50
Empire cms blog template backup

Empire cms blog template backup Program Notes Empire cms

I've prepared the template, and since I don't want to discard it – as I might need it in the future – I've decided to keep it safe! However, changing the template later on with Empire CMS could be quite troublesome, so I've simply shared the code directly. Much of this template consists of PHP code, so please don't download it; this is for personal backup purposes only. Link: https://pan.baidu.com/s/1caeeOl79tDCQDIczknRwZA?pwd=cm...
👁 232