Imperial CMS Common Label Summary _php instances

Source: Internet
Author: User
Determine if a member is logged in

<?PHPIF (!$_cookie[ecmsmlusername]) {$SRR = "login Visible";} else{$SRR = "[!--lbsly--]";}? >
[!--news.url--]skin/default/[e:loop={"Select Classid,classname,bname from Phome_enewsclass where classid= ' $GLOBALS [Navclassid] ' ", 1,24,0}]  <?= $bqr [Bname]?>  [/e:loop][e: loop={"SELECT * from Phome_enewsclass where classid= ' $GLOBALS [Navclassid] '", 1,24,0}]  <?= $bqr [bname]?>  [/e:loop]<?php$fcr=explode (' | ', $class _r[$GLOBALS [Navclassid]][featherclass]); $topbclassid = $FCR [1]?$ FCR[1]: $GLOBALS [navclassid];//gets the top column of the current column id$rs= $empire->fetch1 ("select * from Phome_enewsclass where classid=$ Topbclassid ");? >_<?= $rs [' bname ']?>_<?= $public _r[sitename]?> top column name + website title <?= $class _r[$GLOBALS [navclassid]][ Bname]?> gets the name of the current column  [!--pagetitle--]  or  <?= $class _r[$GLOBALS [navclassid]][bname]?>   
   
   
Isgood=1 firsttitle=1 First-level headline [e:loop={10,3,0,0}] 10 Current column, 3 display bar number, [e:loop={4,1000,0,1, ' leib= ' property News ' ', ' ID DESC '}] 1 have the display of the picture. [e:loop={"SELECT * from PHOME_ECMS_XTGG where firsttitle=1 order by ID DESC limit", 6,24,0}]<?= $bqno?> [!--no.num- -] Cycle ordinal <?= $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: [!--newsnav--]

[!--no.num--]

[!--show.listpage--]

Content page

[!--info.next--] Next [!--info.pre--] Previous article

Universal label with [!--onclick--] Smart label with <?= $BQR [onclick]?> clicks

Copy the Code code 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 statements

Copy the Code code as follows:
<?php
Number of applicants
$num = $empire->gettotal ("SELECT count (*) as total from phome_enewsfeedback where kft= '". $navinfor [title]. "'");
?>

The SQL statement that is often used by the imperial CMS is called:

Please note that if you are in the Empire 7.0 version, you need to remove the checked=1

Copy the Code code 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 the recommended article select * FROM [!db.pre!] Ecms_news where checked=1 and isgood=1 order BY newstime DESC LIMIT 10
3, according to popular article 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, according to the comments ranked select * FROM [!db.pre!] Ecms_news where checked=1 ORDER by plnum DESC LIMIT 10
6, according to the Digg ranking select * FROM [!db.pre!] Ecms_news where checked=1 ORDER by diggtop DESC LIMIT 10
7, according to vote select * FROM [!db.pre!] Ecms_news where checked=1 ORDER by votenum DESC LIMIT 10
8, according to download select * FROM [!db.pre!] Ecms_news where checked=1 ORDER by totaldown DESC LIMIT 10
9, ranked by rating select * FROM [!db.pre!] Ecms_news where checked=1 ORDER by infopfen DESC LIMIT 10

Small tricks included:

PHP Ternary conditional operators:

Copy the Code code as follows:
<?= $bqr [' Ftitle ']? $BQR [' Ftitle ']: $bqr [' title ']?>

Smart or PHP query when invoking the editor content to add stripslashes remove backslashes such as:

Copy the Code code as follows:
<?=stripslashes ($r [' Newstext '])?>

Content page current Information ID:

Copy the Code code as follows:
$navinfor [' ID ']

List content template Information ID:

Copy the Code code as follows:
$r [' ID ']

Current column Name:

Copy the Code code as follows:
$class _r[$GLOBALS [' Navclassid ']][' classname '];

Current Column Parent column:

Copy the Code code as follows:
$class _r[$GLOBALS [' Navclassid ']][' bclassid '];

Current Column Aliases:

Copy the Code code as follows:
$class _r[$GLOBALS [' Navclassid ']][' bname '];

Current column sub-column:

Copy the Code code as follows:
$class _r[$GLOBALS [' Navclassid ']][' Sonclass '];

Current column sub-judgment is the final column:

Copy the Code code as follows:
$class _r[$GLOBALS [' Navclassid ']][' islast '];

Whether the current column has audited information:

Copy the Code code as follows:
$GLOBALS [' num ']==0 for no information

Introduction of PHP path notation in Imperial cms (example is file at root)

Copy the Code code as follows:
<?php include (Ecms_path. "). /bottom.php ");? >

Exclude pinned, headline, recommendation, etc., SQL additional conditions:

Copy the Code code as follows:
' Istop=0 and isgood=0 and Firsttitle=0 '

Upper Parent Column ID:

<?php$bclassid= $class _r[$GLOBALS [navclassid]][bclassid]; $bbclassid = $class _r[$bclassid][bclassid];echo $ Bbclassid;? > $bbclassid is the upper parent column ID

Post, login, feedback, message, etc. jump to the specified page:

Copy the Code code as follows:

Statistics by number of collections:

Copy the Code code 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 collections of this piece of information.

The list, the binding, determines that no information is currently given to the prompt:

<?
if ($GLOBALS [' num ']== ' 0 ') {
?>

Sorry, there is no information for the time being!


<?
}else{
?>
[!--empirenews.listtemp--] [!--empirenews.listtemp--]
<?
}
?>
[/code]

Dynamic use:

Site name: <?= $public _r[' sitename ']?>
Website address: <?= $public _r[' Newsurl ']?>

The time conversion function of the Empire itself:

Copy the Code code as follows:
<?=format_datetime ($BQR [newstime], ' y-m-d ')?>

This function comes with judgment, relatively good, recommended.

Determine whether the content has a picture, there is no picture is displayed in the text of the ad has a picture is not displayed:

Copy the Code code as follows:
<?php
$string = $navinfor [' Newstext '];//content field
$some = "$num =explode ($some, $string);
if (count ($num) >1) {//Determine if there is a picture in the content
?>
[!--newstext--]
<?
}else{
?>
I'm an ad.
[!--newstext--]
<?
}
?>

Intercepting and Filtering Tags:

Copy the Code code as follows:
<?=esub (Htmlspecialchars (Strip_tags ($navinfor [Newstext]))?>

Content pages or Smart tags support title properties
Content page:

Copy the Code code as follows:
<?=dotitlefont ($navinfor [Titlefont], $navinfor [title])?>

Smart Label:

Copy the Code code as follows:
<?=dotitlefont ($BQR [Titlefont], $BQR [title])?>

Title intercept words + Title attributes:

Copy the Code code as follows:
<?=dotitlefont ($bqr [Titlefont],esub ($bqr [title],32, ' ... '))?>

The above mentioned is the whole content of this article, I hope you can like.

  • 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.