Hongmu Notes
Home Program Notes EmpireCMS – Frequently Used Function Library Extension (Continuously Updated)
Program Notes Empire cms

EmpireCMS – Frequently Used Function Library Extension (Continuously Updated)

EmpireCMS – Frequently Used Function Library Extension (Continuously Updated)

Inbound time: shows how many seconds or hours ago the post was published.

 隐藏内容:评论后查看
function user_beforeTime($givenTime) {  
    $givenDateTime = new DateTime($givenTime);  
    $currentTime = new DateTime();  
  
    $timeDiff = $givenDateTime->diff($currentTime);  
    $hoursDiff = $timeDiff->h;  
    $minutesDiff = $timeDiff->i;  
    $secondsDiff = $timeDiff->s;  // 添加秒差  
  
    if ($hoursDiff > 0) {  
        return $hoursDiff . "小时前";  
    } elseif ($minutesDiff > 0) {  
        if ($secondsDiff > 0) {  
            return $minutesDiff . "分钟前";  
        } else {  
            return $minutesDiff . "分钟前";  
        }  
    } elseif ($secondsDiff > 0) {  // 如果时间在一分钟内  
        return $secondsDiff . "前";  
    } else {  
        return $givenTime;  
    }  
}

Category page – retrieves the total number of entries in the current category.

 隐藏内容:评论后查看
function user_ListNum($classArray){
    global $empire,$dbtbpre,$class_r;
    $num = 0;
    $classid = $classArray['classid'];
    if($classArray['bclassid']==0 && $classArray['islast']==0){
        $sql=$empire->query("SELECT classid,allinfos FROM `{$dbtbpre}enewsclass` WHERE bclassid={$classid};");
        while($r=$empire->fetch($sql))
        {
            $num += $r['allinfos'];
        }
    }else{
        $r=$empire->fetch1("select classid,allinfos from {$dbtbpre}enewsclass where classid={$classid}");
        $num = $r['allinfos'];
    }
    
    return $num;
}

Call method:<?=user_ListNum($class_r[$GLOBALS[navclassid]])?>

微信赞赏

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...
👁 295
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…
👁 3748

Recommended reading

Responsive Guitar Tablature Teaching Video Website Template 0776

Responsive Guitar Tablature Teaching Video Website Template 0776 Practical Collection Yiyou template

This EyouCMS responsive template is ideal for websites dedicated to guitar sheet music and instructional videos. Its artistic music-themed design is perfect for showcasing guitar sheet music resources, instructional videos, instrument tutorials, and music-related content. It helps music education platforms attract guitar enthusiasts online. Template Display | Installation Instructions | Website Backend: /login.php | Username: admin | Password: admin | Related Articles: Summary of Common Installation Issues for EyouCMS | EyouCMS (E...
👁 48
(PC+WAP) Mechanical Equipment Parts Machining Website – pbootCMS Template; Metal Machinery Website Source Code Download – 0059

(PC+WAP) Mechanical Equipment Parts Machining Website – pbootCMS Template; Metal Machinery Website Source Code Download – 0059 Practical Collection pbootcms Template

A PbootCMS website template designed specifically for the mechanical equipment parts manufacturing and metal machinery industries, compatible with both PC and WAP devices. Its professional and practical design effectively showcases precision machining capabilities and product details. The template includes built-in product display and technical specification modules, helping machinery manufacturing enterprises attract targeted customers and enhance brand trust. Template Display | Installation Instructions | Website Backend: /admin.php | Username: admin | Password:...
👁 63
(Adaptive Mobile Version) HTML5 Investment & Wealth Management – Responsive Overseas Wealth Management and Investment Management PBootCMS Template – 0681

(Adaptive Mobile Version) HTML5 Investment & Wealth Management – Responsive Overseas Wealth Management and Investment Management PBootCMS Template – 0681 Practical Collection pbootcms Template

A PbootCMS responsive template designed for investment and wealth management as well as overseas investment management purposes, compatible with both PC and WAP devices. Its modern, premium design is ideal for showcasing wealth management products, investment returns, and risk management strategies. This template helps overseas wealth management institutions or financial companies attract high-net-worth clients online. Template Display | Installation Instructions | Website Backend: /admin.php | Username: admin | Password: admin | Extraction Password: www.4s5.cn...
👁 30
QQ Personal Space – Blog/News Website Template 0136

QQ Personal Space – Blog/News Website Template 0136 Practical Collection Yiyou template

An eYouCMS template designed for QQ Personal Space, blog/chronicle websites, and news/information platforms. Its fresh and artistic design makes it ideal for hosting emotional journals, personalized signatures, engaging blog posts, and real-time updates. This template helps individual webmasters or bloggers build personalized content-sharing platforms. Template Preview | Installation Instructions | Website Backend: /login.php | Username: admin | Password: admin | Related Articles: Summary of Common Installation Issues for eYouCMS | eYou...
👁 29
Responsive Bidding and Tendering Website Template 0777

Responsive Bidding and Tendering Website Template 0777 Practical Collection Yiyou template

An EyouCMS responsive template designed specifically for tendering and bidding websites. Its professional business-oriented design is ideal for displaying tender announcements, bidding information, procurement projects, and corporate directories. This template helps tendering and bidding information platforms attract businesses and suppliers online. Template Display | Installation Instructions | Website Backend: /login.php | Username: admin | Password: admin | Related Articles: Summary of Common Installation Issues for EyouCMS | EyouCMS (Eyo...
👁 30
Reinstall Python and requests libraries

Reinstall Python and requests libraries Language Notes python

If you meet " Import " requests" could not be resolved from source" You can try reinstalling Python and requests libraries. First, you need to uninstall the current Python and requests libraries. On Windows systems, you can use the command prompt …
👁 439