Home >Backend Development >PHP Tutorial >Summary of commonly used tags in Empire CMS, summary of Empire CMS_PHP tutorial
Determine whether a member is logged in
<?php if(!$_COOKIE[ecmsmlusername]){ $srr="登录可见"; }else{ $srr="[!--lbsly--]"; } ?>
[!--news.url--]skin/default/ [e:loop={"select classid,classname,bname from phome_enewsclass where classid='$GLOBALS[navclassid]'",1,24,0}]<title><?=$bqr[bname]?></title>[/e:loop] [e:loop={"select * from phome_enewsclass where classid='$GLOBALS[navclassid]'",1,24,0}]<title><?=$bqr[bname]?></title>[/e:loop] <?php $fcr=explode('|',$class_r[$GLOBALS[navclassid]][featherclass]); $topbclassid=$fcr[1]?$fcr[1]:$GLOBALS[navclassid];//取得当前栏目的顶级栏目ID $rs=$empire->fetch1("select * from phome_enewsclass where classid=$topbclassid"); ?> _<?=$rs['bname']?>_<?=$public_r[sitename]?> 顶级栏目名称+网站标题 <?=$class_r[$GLOBALS[navclassid]][bname]?> 得到当前栏目的名称 <title>[!--pagetitle--] </title> 或 <title><?=$class_r[$GLOBALS[navclassid]][bname]?></title> <meta name="keywords" content="[!--pagekey--]" /> <meta name="description" content="[!--pagedes--]" />
isgood=1 一级推荐 firsttitle=1 一级头条 [e:loop={10,3,0,0}] 10当前栏目,3显示条数, [e:loop={4,1000,0,1,'leib="楼市快讯"','id DESC'}] 1有图片的显示。 [e:loop={"select * from phome_ecms_xtgg where firsttitle=1 order by id DESC limit 20",6,24,0}] <?=$bqno?> [!--no.num--] 循环序号 <?=$bqsr['titleurl']?> <?=$bqr[title]?> <?=esub($bqr[title],8)?> [/e:loop]
3ea4ef902998a184a229211e8cbe0553
Time call tag: d791d315641d4fbedbe4fd9dc4d3bc41
List page
Your current location: [!--newsnav--]
[!--no.num--]
[!--show.listpage--]
Content page
[!--info.next--]Next article [!--info.pre--]Previous article
Use [!--onclick--] for universal tags and 6609c0acca9afed3b504ae64b3323bb0 for smart tags; click volume
Copy code The code is as follows:
$titleurl=sys_ReturnBqTitleLink($navinfor); Get the URL of the current page
$url = "http://".$_SERVER ['HTTP_HOST'].$_SERVER['PHP_SELF']; Get the URL of the current page
sql statement
Copy code The code is as follows:
1df56b6513c617545083c292642f8cf9gettotal("select count(*) as total from phome_enewsfeedback where kft='".$navinfor[title]."'");
?>
Sql statements often used by Empire CMS:
Please note that if it is Empire version 7.0, you need to remove checked=1
Copy code The code is as follows:
1. According to the latest article select * from [!db.pre!]ecms_news where checked=1 order by newstime desc limit 10
2. According to recommended articles select * from [!db.pre!]ecms_news where checked=1 and isgood=1 order by newstime desc limit 10
3. According to popular articles select * from [!db.pre!]ecms_news where checked=1 order by onclick desc limit 10
4. According to the headline news select * from [!db.pre!]ecms_news where checked=1 and firsttitle=1 order by newstime desc limit 10
5. Rank according to comments select * from [!db.pre!]ecms_news where checked=1 order by plnum desc limit 10
6. According to digg ranking select * from [!db.pre!]ecms_news where checked=1 order by diggtop desc limit 10
7. According to voting ranking select * from [!db.pre!]ecms_news where checked=1 order by votenum desc limit 10
8. According to the download ranking select * from [!db.pre!]ecms_news where checked=1 order by totaldown desc limit 10
9. Ranking based on ratings select * from [!db.pre!]ecms_news where checked=1 order by infopfen desc limit 10
Tips included:
php ternary conditional operator:
Copy code The code is as follows:
761e7172486a1f8b0008b76c45e31dfb
When calling the editor content in Smart or PHP query, you need to add stripslashes and delete the backslashes, for example:
Copy code The code is as follows:
9c5d49dab0ec24881f8f0d422fe098ee
Current information ID of content page:
Copy code The code is as follows:
$navinfor['id']
List content template information ID:
Copy code The code is as follows:
$r['id']
Current column name:
Copy code The code is as follows:
$class_r[$GLOBALS['navclassid']]['classname'];
Current column’s parent column:
Copy code The code is as follows:
$class_r[$GLOBALS['navclassid']]['bclassid'];
Current column alias:
Copy code The code is as follows:
$class_r[$GLOBALS['navclassid']]['bname'];
Current column sub-column:
Copy code The code is as follows:
$class_r[$GLOBALS['navclassid']]['sonclass'];
To determine whether the current column is the final column:
Copy code The code is as follows:
$class_r[$GLOBALS['navclassid']]['islast'];
Whether the current column has reviewed information:
Copy code The code is as follows:
$GLOBALS['num']==0 means no information
Introduction of php path writing method in empire cms (example is the file is in the root directory)
Copy code The code is as follows:
0bf02c651a2620fa6be5d963f2234ce8
Exclude top posts, headlines, recommendations, etc., sql additional conditions:
Copy code The code is as follows:
'istop=0 and isgood=0 and firsttitle=0'
Superior column id:
<?php $bclassid=$class_r[$GLOBALS[navclassid]][bclassid]; $bbclassid=$class_r[$bclassid][bclassid]; echo $bbclassid; ?> $bbclassid就是上上级父栏目id
Jump to the specified page after submission, login, feedback, message, etc.:
Copy code The code is as follows:
1111b8f6f4a6bfc5f3af664aca3605d2
Number of statistics collected:
Copy code The code is as follows:
89ec8a664110e579199bf9b3617cc744gettotal("select count(*) as total from {$dbtbpre}enewsfava where id='$navinfor[id]' and classid='$GLOBALS[navclassid]'");
?>
ecc6e922ebc0d67a4c075aa3cf0dd4b7That’s the number of favorites for this message
List and combination items judge that there is currently no information and give a prompt:
7de8b41c1810df0c9976d0337ef0a511
e388a4556c0f65e1904146cc1a846beeSorry, there is no information at the moment! 94b3e26ee717c64999d7867364b1b4a3
9ec4feaf5ac4c8464dc1b3ae1fda447b
[!--empirenews.listtemp--]ceec88896e6049fa15f5bf65fd60ada7[!--empirenews.listtemp--]
120f2a3c664e921ed72de62882ea6fc5
[/code]
Dynamic usage:
Site name: 3a822df9be0e61f87590808c87956747
Website address: 76457f2f2b2a465793f8206ef96ed7fc
The empire’s own time conversion function:
Copy code The code is as follows:
e44db89780f99a2144df4342981f4ff6
This function comes with its own judgment, which is quite good and recommended.
Determine whether the content has pictures. If there are no pictures, the ads in the text will be displayed. If there are pictures, they will not be displayed:
Copy code The code is as follows:
32e8a5245793238e088b8e92191196a01){//Determine whether there are pictures in the content
?>
[!--newstext--]
9ec4feaf5ac4c8464dc1b3ae1fda447b
4fef6d397b7acc2f9f5575fbde428a50I am an advertisement16b28748ea4df4d9c2150843fecfba68
[!--newstext--]
120f2a3c664e921ed72de62882ea6fc5
Intercept and add filter tags:
Copy code The code is as follows:
3823fef5e2a22ef4a58eb10e9a5acf21
Content page or smart tag supports title attribute
Content page:
Copy code The code is as follows:
3e92b8ab24079f2a3cedb4acb8a7f7df
Smart tags:
Copy code The code is as follows:
a7635a614732c882d74b1da091c745f5
Number of words for title interception Title attributes:
Copy code The code is as follows:
b06c3267dd099f75f2104389b098a701
The above is the entire content of this article, I hope you all like it.