Home Backend Development PHP Tutorial 帝国cms常用标签汇总_php实例

帝国cms常用标签汇总_php实例

Jun 07, 2016 pm 05:12 PM
Empire cms

判断会员是否登录

<&#63;php
if(!$_COOKIE[ecmsmlusername]){
$srr="登录可见";
}else{
$srr="[!--lbsly--]";
}
&#63;>
Copy after login
[!--news.url--]skin/default/

[e:loop={"select classid,classname,bname from phome_enewsclass where classid='$GLOBALS[navclassid]'",1,24,0}]<title><&#63;=$bqr[bname]&#63;></title>[/e:loop]

[e:loop={"select * from phome_enewsclass where classid='$GLOBALS[navclassid]'",1,24,0}]<title><&#63;=$bqr[bname]&#63;></title>[/e:loop]

<&#63;php
$fcr=explode('|',$class_r[$GLOBALS[navclassid]][featherclass]);
$topbclassid=$fcr[1]&#63;$fcr[1]:$GLOBALS[navclassid];//取得当前栏目的顶级栏目ID
$rs=$empire->fetch1("select * from phome_enewsclass where classid=$topbclassid");
&#63;>
_<&#63;=$rs['bname']&#63;>_<&#63;=$public_r[sitename]&#63;> 顶级栏目名称+网站标题

<&#63;=$class_r[$GLOBALS[navclassid]][bname]&#63;> 得到当前栏目的名称
<title>[!--pagetitle--] </title> 或  <title><&#63;=$class_r[$GLOBALS[navclassid]][bname]&#63;></title>
<meta name="keywords" content="[!--pagekey--]" />
<meta name="description" content="[!--pagedes--]" />

Copy after login
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}]

<&#63;=$bqno&#63;> [!--no.num--] 循环序号

<&#63;=$bqsr['titleurl']&#63;> <&#63;=$bqr[title]&#63;> <&#63;=esub($bqr[title],8)&#63;>

[/e:loop]

Copy after login

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

时间调用标签:<?=date("Y-m-d",$bqr['newstime'])?>


列表页

您当前的位置:[!--newsnav--]

[!--no.num--]

[!--show.listpage--]

内容页

[!--info.next--]下一篇 [!--info.pre--]上一篇

万能标签用[!--onclick--] 灵动标签用<?=$bqr[onclick]?> 点击量

复制代码 代码如下:

$titleurl=sys_ReturnBqTitleLink($navinfor); 获得当前页面的网址
$url = "http://".$_SERVER ['HTTP_HOST'].$_SERVER['PHP_SELF']; 获得当前页面的网址

sql语句

复制代码 代码如下:

<?php
//报名人数
$num=$empire->gettotal("select count(*) as total from phome_enewsfeedback where kft='".$navinfor[title]."'");
?>

帝国CMS经常用到的调用sql语句:

请注意,如果是帝国7.0版本的,需要将checked=1去掉

复制代码 代码如下:

  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,根据digg排行 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

小技巧收录:

php三元条件运算符:

复制代码 代码如下:

<?=$bqr['ftitle']?$bqr['ftitle']:$bqr['title']?>

灵动或者php查询调用编辑器内容的时候要加stripslashes删除反斜杠比如:

复制代码 代码如下:

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

内容页当前信息ID:

复制代码 代码如下:

$navinfor['id']

列表内容模板信息ID:

复制代码 代码如下:

$r['id']

当前栏目名:

复制代码 代码如下:

$class_r[$GLOBALS['navclassid']]['classname'];

当前栏目父栏目:

复制代码 代码如下:

$class_r[$GLOBALS['navclassid']]['bclassid'];

当前栏目别名:

复制代码 代码如下:

$class_r[$GLOBALS['navclassid']]['bname'];

当前栏目子栏目:

复制代码 代码如下:

$class_r[$GLOBALS['navclassid']]['sonclass'];

当前栏目子判断是否为终级栏目:

复制代码 代码如下:

$class_r[$GLOBALS['navclassid']]['islast'];

当前栏目是否有已审核信息:

复制代码 代码如下:

$GLOBALS['num']==0为没有信息

帝国cms中引入php路径写法(例子是文件在根目录)

复制代码 代码如下:

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

排除置顶、头条、推荐等,sql附加条件:

复制代码 代码如下:

'istop=0 and isgood=0 and firsttitle=0'

上上级栏目id:

<&#63;php
$bclassid=$class_r[$GLOBALS[navclassid]][bclassid];
$bbclassid=$class_r[$bclassid][bclassid];
echo $bbclassid;
&#63;>
$bbclassid就是上上级父栏目id

Copy after login

投稿、登陆、反馈、留言等之后跳转指定页面:

复制代码 代码如下:


统计信息被收藏数:

复制代码 代码如下:

$favas=$empire->gettotal("select count(*) as total from {$dbtbpre}enewsfava where id='$navinfor[id]' and classid='$GLOBALS[navclassid]'");
?>
就是这条信息的收藏数

列表、结合项判断当前没有信息给出提示:

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

对不起,暂时没有任何信息!


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

动态使用:

网站名称:
网站地址:

帝国自身的时间转换函数:

复制代码 代码如下:


此函数自带判断,比较不错,推荐。

判断内容是否有图片,没有图片则显示文中广告 有图片则不显示:

复制代码 代码如下:

$string=$navinfor['newstext'];//内容字段
$some="帝国cms常用标签汇总_php实例 $num=explode($some,$string);
if(count($num)>1){//判断内容中是否有图片
?>
[!--newstext--]
}else{
?>

[!--newstext--]
}
?>

截取加过滤标签:

复制代码 代码如下:


内容页或灵动标签支持标题属性
内容页:

复制代码 代码如下:


灵动标签:

复制代码 代码如下:


标题截取字数+标题属性:

复制代码 代码如下:


以上所述就是本文的全部内容了,希望大家能够喜欢。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Where is the imperial cms website map? Where is the imperial cms website map? Apr 17, 2024 am 10:48 AM

The Empire CMS sitemap can be found by accessing the config.inc.php file and checking the dositemap settings. If set to "on", sitemap is enabled. The sitemap path is located in the sitemapurl setting and can be accessed via a browser or downloaded via FTP.

Where are the settings for the mobile version of Empire CMS? Where are the settings for the mobile version of Empire CMS? Apr 17, 2024 pm 12:12 PM

The mobile settings of Empire CMS are located in the "Mobile Template" of the "Template Management" module. The specific steps include: enabling the template, selecting the application channel, editing the template content, and saving the settings.

Where can I put the empire cms template file for easy use? Where can I put the empire cms template file for easy use? Apr 17, 2024 am 07:22 AM

The ideal location for the Empire CMS template file is /e/template/default/skin/default/. Secondly, it can also be placed in /e/data/skins/ and /e/skin/. You need to pay attention to maintaining the folder structure and setting file permissions. and regular backups.

Where to find the empire cms database configuration file Where to find the empire cms database configuration file Apr 17, 2024 am 06:42 AM

The Imperial CMS database configuration file is located in the website root directory e/config/db.inc.php. It contains the following configuration information: $dbhost: database server address $dbuser: database user name $dbpass: database password $dbname: database name $dbport :Database port $dbcharset: Database character set

Where is the imperial cms resource network template? Where is the imperial cms resource network template? Apr 17, 2024 am 10:00 AM

Empire CMS template download location: Official template download: https://www.phome.net/template/ Third-party template website: https://www.dedecms.com/diy/https://www.0978.com.cn /https://www.jiaocheng.com/Installation method: Download template Unzip template Upload template Select template

Where is the automatic publishing interface of Empire CMS? Where is the automatic publishing interface of Empire CMS? Apr 17, 2024 am 09:03 AM

The automatic publishing interface of Empire CMS is located at /e/api/web/postinfo.php. The usage steps are as follows: visit /e/api/web/postinfo.php address and use HTTP POST to submit the article title, column ID, category ID, author and article The content and other data interfaces will return a response in JSON format, which contains the publishing results and article ID.

Where is the Baidu active push plug-in for Imperial CMS? Where is the Baidu active push plug-in for Imperial CMS? Apr 17, 2024 am 11:00 AM

The imperial cms Baidu active push plug-in is located in the root directory /e/api/baidu/push.php. The specific configuration steps are as follows: 1. Upload the plug-in file to the specified path. 2. Configure the "Baidu Active Push" option in the Imperial CMS background, including push address, API Key and push interval. 3. Get Baidu push information: Push address: https://data.zz.baidu.com/urls?site=YOUR_SITE&token=YOUR_API_KEY, API Key: log in to Baidu search resource platform to obtain. 4. Update the API Key regularly and set a reasonable push interval.

Is empire cms free? Is empire cms free? Apr 17, 2024 am 11:24 AM

Yes, Empire CMS is a free and open source content management system (CMS). It is a lightweight CMS that is feature-rich and easy to use. Empire CMS is licensed under the GNU General Public License (GPL), which means it is free to download, install and use. For commercial use, it offers a paid version that offers additional features and support such as ad management, online payments, and premium technical support.

See all articles