Summary of common CMS tags and CMS tags

Source: Internet
Author: User

Summary of common CMS tags and CMS tags

Determine whether a member is logged on

<? Phpif (! $ _ COOKIE [ecmsmlusername]) {$ srr = "visible Logon";} 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]; // obtain the top-level topic ID of the current topic $ rs = $ empire-> fetire ("select * from phome_enewsclass where classid = $ topbclassid");?> _ <? = $ Rs ['bname']?> _ <? = $ Public_r [sitename]?> Top-level topic name + website title <? = $ Class_r [$ GLOBALS [navclassid] [bname]?> Obtain the name of the current topic <title> [! -- Pagetitle --] </title> or <title> <? = $ Class_r [$ GLOBALS [navclassid] [bname]?> </Title> <meta name = "keywords" content = "[! -- Pagekey --] "/> <meta name =" description "content = "[! -- Pagedes --] "/>
Isgood = 1 Level 1 recommendation firsttitle = 1 Level 1 headlines [e: loop = {10, 3,}] 10 current column, 3 display number, [e: loop =, 'leib = "" ', 'Id DESC'}] 1 displays images. [E: loop = {"select * from phome_ecms_xtgg where firsttitle = 1 order by id DESC limit 20", 6, 24, 0}] <? = $ Bqno?> [! -- No. num --] cyclic sequence number <? = $ Bqsr ['titleurl']?> <? = $ Bqr [title]?> <? = Esub ($ bqr [title], 8)?> [/E: loop]

<? = DoWapRepNewstext ($ r [newstext])?>

Time call Tag: <? = Date ("Y-m-d", $ bqr ['newstime'])?>


List page

Your current location :[! -- Newsnail v --]

[! -- No. num --]

[! -- Show. listpage --]

Content Page

[! -- Info. next --] next [! -- Info. pre --] previous

Universal Label [! -- Onclick --] use smart tags <? = $ Bqr [onclick]?> Clicks

Copy codeThe 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 codeThe Code is as follows:
<? Php
// Number of registrants
$ Num = $ empire-> gettotal ("select count (*) as total from phome_enewsfeedback where kft = '". $ navinfor [title]. "'");
?>

The SQL statements that are frequently used by the Empire CMS:

Note that if the version is of Empire 7.0, you need to remove checked = 1.

Copy codeThe Code is as follows:
1. select * from [! Db. pre!] Ecms_news where checked = 1 order by newstime desc limit 10
2. select * from [! Db. pre!] Ecms_news where checked = 1 and isgood = 1 order by newstime desc limit 10
3. select * from [! Db. pre!] Ecms_news where checked = 1 order by onclick desc limit 10
4. select * from [! Db. pre!] Ecms_news where checked = 1 and firsttitle = 1 order by newstime desc limit 10
5. select * from [! Db. pre!] Ecms_news where checked = 1 order by plnum desc limit 10
6. select * from [! Db. pre!] Ecms_news where checked = 1 order by diggtop desc limit 10
7. select * from [! Db. pre!] Ecms_news where checked = 1 order by votenum desc limit 10
8. select * from [! Db. pre!] Ecms_news where checked = 1 order by totaldown desc limit 10
9. select * from [! Db. pre!] Ecms_news where checked = 1 order by infopfen desc limit 10

TIPS:

Php ternary conditional operators:

Copy codeThe Code is as follows:
<? = $ Bqr ['ftitle']? $ Bqr ['ftitle']: $ bqr ['title']?>

Add stripslashes to delete the backslash when querying and calling the editor content in smart or php, for example:

Copy codeThe Code is as follows:
<? = Stripslashes ($ r ['newstext '])?>

Current information ID on the Content Page:

Copy codeThe Code is as follows:
$ Navinfor ['id']

List content template information ID:

Copy codeThe Code is as follows:
$ R ['id']

Current topic Name:

Copy codeThe Code is as follows:
$ Class_r [$ GLOBALS ['navclassid '] ['classname'];

Parent topic of the current topic:

Copy codeThe Code is as follows:
$ Class_r [$ GLOBALS ['navclassid '] ['bclassid'];

Current column alias:

Copy codeThe Code is as follows:
$ Class_r [$ GLOBALS ['navclassid '] ['bname'];

Subtopic of the current topic:

Copy codeThe Code is as follows:
$ Class_r [$ GLOBALS ['navclassid '] ['sonclass'];

Determine whether the current topic is a final topic:

Copy codeThe Code is as follows:
$ Class_r [$ GLOBALS ['navclassid '] ['isla'];

Whether the current topic has been reviewed:

Copy codeThe Code is as follows:
$ GLOBALS ['num'] = 0 indicates no information

Introduce php path writing in Empire CMS (the example is that the file is in the root directory)

Copy codeThe Code is as follows:
<? Php include (ECMS_PATH. "./bottom. php");?>

Exclude top posts, headlines, recommendations, and other SQL appending conditions:

Copy codeThe Code is as follows:
'Istop = 0 and isgood = 0 and firsttitle = 0'

Parent topic id:

<? Php $ bclassid = $ class_r [$ GLOBALS [navclassid] [bclassid]; $ bbclassid = $ class_r [$ bclassid] [bclassid]; echo $ bbclassid;?> $ Bbclassid is the parent topic id

After the submission, login, feedback, and comments, go to the specified page:

Copy codeThe Code is as follows:
<Input type = hidden name = ecmsfrom value = "Return page address">

Number of statistical items added to favorites:

Copy codeThe Code is as follows:
<?
$ Favas = $ empire-> gettotal ("select count (*) as total from {$ dbtbpre} enewsfava where id = '$ navinfor [id]' and classid = '$ GLOBALS [navclassid]' ");
?>
<? = $ Favas?> Is the number of favorites of this information.

List, combined items to determine whether there is currently no information to give a prompt:

<?
If ($ GLOBALS ['num'] = '0 '){
?>
<P> sorry, there is no information for the moment! </P>
<?
} Else {
?>
[! -- Empirenews. listtemp --] <! -- List. var1 --> [! -- Empirenews. listtemp --]
<?
}
?>
[/Code]

Dynamic use:

Website name: <? = $ Public_r ['sitename']?>
Website address: <? = $ Public_r ['newurl']?>

Time conversion functions of the Empire itself:

Copy codeThe Code is as follows:
<? = Format_datetime ($ bqr [newstime], 'Y-m-d')?>

This function has its own judgment, which is good and recommended.

Determine whether there are images in the content. If there is no image, the advertisement in the text will not be displayed if there is an image:

Copy codeThe Code is as follows:
<? Php
$ String = $ navinfor ['newstext ']; // content field
$ Some = "$ Num = explode ($ some, $ string );
If (count ($ num)> 1) {// you can check whether an image exists in the content.
?>
[! -- Newstext --]
<?
} Else {
?>
<Div id = "ad"> I am an advertisement </div>
[! -- Newstext --]
<?
}
?>

Filter tags:

Copy codeThe Code is as follows:
<? = Esub (htmlspecialchars (strip_tags ($ navinfor [newstext]), 160)?>

Content pages or smart tags support title attributes
Content Page:

Copy codeThe Code is as follows:
<? = DoTitleFont ($ navinfor [titlefont], $ navinfor [title])?>

Smart Tag:

Copy codeThe Code is as follows:
<? = DoTitleFont ($ bqr [titlefont], $ bqr [title])?>

Title truncation words + title attributes:

Copy codeThe Code is as follows:
<? = DoTitleFont ($ bqr [titlefont], esub ($ bqr [title], 32, '...')?>

The above is all the content of this article. I hope you will like it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.