Imperial CMS Common Label Summary _php instance

Source: Internet
Author: User
Tags explode

Judge whether the member is logged in

<?php
if (!$_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}]<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];//gets the top column ID of the current column $rs = $empire->fetch1 ("SELECT * from Phome_

Enewsclass where classid= $topbclassid ");?> _<?= $rs [' bname ']?>_<?= $public _r[sitename]?> Top column name + site title <?= $class _r[$GLOBALS [navclassid]][bname]?> Get the name of the current column <title>[!--pagetitle--] </title> or <title ><?= $class _r[$GLOBALS [navclassid]][bname]?></title> <meta name= "keywords" content= "[!-- pagekey--] "/> <meta name= description" content= "[!--pagedes--]"/> 
Isgood=1 recommended firsttitle=1 First-

level headlines

[e:loop={10,3,0,0}] 10 current columns, 3 show number,

[e:loop={4,1000,0,1, ' leib= ' property alert ', ' ID DESC '}] 1 has a picture display.

[e:loop={"select * from PHOME_ECMS_XTGG where firsttitle=1 order by ID DESC limit", 6,24,0}]

<?= $bqno?> [ !--no.num--] Loop ordinal

<?= $bqsr [' Titleurl ']?> <?= $bqr [title]?> <?=esub ($bqr [title],8)?>

[/e: Loop

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

Time Call Tags: <?=date ("y-m-d", $bqr [' Newstime '])?>


List Page

Your current location: [!--newsnav--]

[!--no.num--]

[!--show.listpage--]

Content page

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

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

Copy 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 statement

Copy Code code as follows:

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

Imperial CMS often uses the call to SQL statements:

Please note that if the Empire 7.0 version is required to remove the checked=1

Copy 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 press SELECT * FROM [!db.pre!] Ecms_news where checked=1 and firsttitle=1 order BY newstime DESC LIMIT 10
5, ranked by comment select * FROM [!db.pre!] Ecms_news where checked=1 ORDER by plnum DESC LIMIT 10
6, based on Digg select * FROM [!db.pre!] Ecms_news where checked=1 ORDER by diggtop DESC LIMIT 10
7, ranked by vote select * FROM [!db.pre!] Ecms_news where checked=1 ORDER by votenum DESC LIMIT 10
8, according to download ranking select * FROM [!db.pre!] Ecms_news where checked=1 ORDER by totaldown DESC LIMIT 10
9, ranking select * FROM [!db.pre!] according to rating Ecms_news where checked=1 ORDER by infopfen DESC LIMIT 10

Small tips included:

PHP Ternary conditional operator:

Copy Code code as follows:

<?= $bqr [' Ftitle ']? $BQR [' Ftitle ']: $bqr [' title ']?>

Smart or PHP query Invoke editor content to add stripslashes remove backslash such as:

Copy Code code as follows:

<?=stripslashes ($r [' Newstext '])?>

Content page current Information ID:

Copy Code code as follows:

$navinfor [' ID ']

List content template Information ID:

Copy Code code as follows:

$r [' ID ']

Current column Name:

Copy Code code as follows:

$class _r[$GLOBALS [' Navclassid ']][' classname '];

Current Column Parent column:

Copy Code code as follows:

$class _r[$GLOBALS [' Navclassid ']][' bclassid '];

Current column alias:

Copy Code code as follows:

$class _r[$GLOBALS [' Navclassid ']][' bname '];

Current Column column:

Copy Code code as follows:

$class _r[$GLOBALS [' Navclassid ']][' Sonclass '];

The current column to determine whether the final class column:

Copy Code code as follows:

$class _r[$GLOBALS [' Navclassid ']][' islast '];

Whether the current column has approved information:

Copy Code code as follows:

$GLOBALS [' num ']==0 for no information

Empire CMS introduced PHP path notation (example is file in root directory)

Copy Code code as follows:

<?php include (Ecms_path. "). /bottom.php ");? >

Exclude top, headline, recommendation, etc., SQL attach condition:

Copy 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

Submit, login, feedback, message, etc. jump to specify the page:

Copy Code code as follows:

<input Type=hidden name=ecmsfrom value= "return page address" >

Statistics are collected:

Copy 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 collection of this message.

List, binding item to determine that there is currently no information to give a hint:

?
if ($GLOBALS [' num ']== ' 0 ') {
?>
<p> Sorry, there is no information at the moment! </p>
?
}else{
?>
[!--empirenews.listtemp--]<!--list.var1-->[!--empirenews.listtemp--]
?
}
?>
[/code]

Dynamic use:

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

The time conversion function of the Empire itself:

Copy Code code as follows:

<?=format_datetime ($BQR [newstime], ' y-m-d ')?>

This function with the judgment, relatively good, recommended.

To determine whether the content has pictures, no pictures are displayed in the text ads are not displayed in the picture:

Copy 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{
?>
<div id= "ad" > I am an advertisement </div>
[!--newstext--]
?
}
?>

Interception Plus Filter Label:

Copy Code code as follows:

<?=esub (Htmlspecialchars (Strip_tags ($navinfor [Newstext]), 160)?>

Content page or smart Tag support caption Properties
Content page:

Copy Code code as follows:

<?=dotitlefont ($navinfor [Titlefont], $navinfor [title])?>

Smart Tags:

Copy Code code as follows:

<?=dotitlefont ($BQR [Titlefont], $BQR [title])?>

Title Intercept Word number + caption attribute:

Copy Code code as follows:

<?=dotitlefont ($bqr [Titlefont],esub ($bqr [title],32, ' ... ')]?>

The above mentioned is the entire content of this article, I hope you can enjoy.

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.