红穆笔记
首頁 › 程序筆記 › 帝國cms8.0 新手仿站學習教程
程序筆記 帝國cms

帝國cms8.0 新手仿站學習教程

帝国cms8.0 新手仿站学习教程

QQ交流羣:958972323

所需工具:

本地服務器環境:https://www.xp.cn/

網站域名 127.0.0.1

帝國cms8.0 下載地址:http://www.phome.net/down/

編輯器:Notepad++

頁面下載工具:仿站小工具

在線html格式化:在線HTML代碼格式化 - HTML代碼美化工具

頁面類型:

首頁:https://simplee.001666.cn/

列表頁:https://simplee.001666.cn/info/

內容頁:https://simplee.001666.cn/blog/265.html

導航代碼調用:

<?php
// 查詢一級菜單
$sql = $empire->query("select classid, sonclass, classname, islast, islist from {$dbtbpre}enewsclass where bclassid=0 and showclass=0 order by myorder asc");
while ($primaryMenu = $empire->fetch($sql)) {
    $classUrl = sys_ReturnBqClassname($primaryMenu, 9); 
    $topClass = '';
    $featherClass = explode('|', $class_r[$GLOBALS['navclassid']]['featherclass']);
    $topbclassid = $featherClass[1] ? $featherClass[1] : $GLOBALS['navclassid'];
    
    // 判斷是否爲當前菜單
    if ($topbclassid == $primaryMenu['classid']) {
        $topClass = 'active';
    }
    //$value=ReturnClassAddField($primaryMenu['classid'],'icon');
?>
						<li id="navbar-category-1" class="<?=$topClass?>">
                            <a href="<?=$classUrl?>">
                                <i class="fa <?=$value?>"></i><?=$primaryMenu['classname']?>
                            </a>
                        </li>
						
<?}?>

站點圖標庫:圖標庫 – Font Awesome 中文網

萬能標籤調用文章:

[!--empirenews.listtemp--]<!--list.var1-->[!--empirenews.listtemp--]

靈動標籤調用文章:

帝國CMS靈動標籤調用字段大全-紅穆筆記

TAG調用:

<?php
$num=$empire->num("select tagid from {$dbtbpre}enewstags");
$randnum=100; 
$randids=''; 
$randdh=''; 
for($i=1;$i<=$randnum;$i++) 
{ 
$randids.=$randdh.rand(1,$num); 
$randdh=',';
} 
?>
[e:loop={"select tagname,tagid,num from phome_enewstags where tagid in ($randids)  limit $randnum",32,24,0}]
<a target="_blank" href="/tag/<?=$bqr['tagid']?>/" title="<?=$bqr['tagname']?>"><?=$bqr['tagname']?></a> | 
[/e:loop]

友情鏈接調用:

帝國cms首頁底部友情鏈接如何用靈動標籤調用?-紅穆筆記

首頁標題的調用:

帝國cms列表頁內容頁的標題代碼-紅穆筆記

分頁調用

方法一:修改css,達到仿站效果(推薦指數二顆星)

難度較高:靈活調用,需要懂css,能根據目標站點,修改css代碼

.pagination .navigation a,.pagination span {background-color:#fff;line-height:28px;height:28px;width:60px;text-align:center;margin:0 10px 0 0;display:block;float:left;color:#000;box-shadow:0 0 5px rgba(0,0,0,0.2);position:relative}

.pagination .navigation>b {
    background-color: #fff;
    line-height: 28px;
    height: 28px;
    width: 60px;
    text-align: center;
    margin: 0 10px 0 0;
    display: block;
    float: left;
    color: #000;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
    position: relative;
    font-weight: 400;
}

方法二:自定義分頁函數(推薦指數一顆星)

難度中等:修改php文件中的html結構,通過結構適配css代碼。

<?php
//---------------------------用戶自定義標籤函數文件
//列表模板之列表式分頁
function usr_ShowListMorePage($num,$page,$dolink,$type,$totalpage,$line,$ok,$search="",$add=null){
	global $fun_r,$public_r;
	if($num<=$line)
	{
		$pager['showpage']='';
		return $pager;
	}
	//文件名
	if(empty($add['dofile']))
	{
		$add['dofile']='index';
	}
	//靜態頁數
	$repagenum=$add['repagenum'];
	$page_line=$public_r['listpagelistnum'];
	$snum=2;
	//$totalpage=ceil($num/$line);//取得總頁數
	$firststr='';
	//上一頁
	if($page<>1)
	{
		$toppage='<a  class="page-numbers" title="第&lt;&lt;頁" href="'.$dolink.$add['dofile'].$type.'"><span class="page">&lt;&lt;</span></a>';
		$pagepr=$page-1;
		if($pagepr==1)
		{
			$prido=$add['dofile'].$type;
		}
		else
		{
			$prido=$add['dofile'].'_'.$pagepr.$type;
		}
		$prepage='<a class="page-numbers"  href="'.$dolink.$prido.'"><span class="page">&lt;</span></a>';
	}
	//下一頁
	if($page!=$totalpage)
	{
		$pagenex=$page+1;
		$nextpagelink=$repagenum&&$repagenum<$pagenex?eReturnRewritePageLink2($add,$pagenex):$dolink.$add['dofile'].'_'.$pagenex.$type;
		$lastpagelink=$repagenum&&$repagenum<$totalpage?eReturnRewritePageLink2($add,$totalpage):$dolink.$add['dofile'].'_'.$totalpage.$type;
		$nextpage='<a href="'.$nextpagelink.'"><span class="page">&gt;</span></a>';
		$lastpage='<a href="'.$lastpagelink.'"><span class="page">&gt;&gt;</span></a>';
	}
	$starti=$page-$snum<1?1:$page-$snum;
	$no=0;
	for($i=$starti;$i<=$totalpage&&$no<$page_line;$i++)
	{
		$no++;
		if($page==$i)
		{
			$is_1="<span class=\"page now-page\">";
			$is_2="</span>";
		}
		elseif($i==1)
		{
			$is_1='<a href="'.$dolink.$add['dofile'].$type.'">';
			$is_2="</a>";
		}
		else
		{
			$thispagelink=$repagenum&&$repagenum<$i?eReturnRewritePageLink2($add,$i):$dolink.$add['dofile'].'_'.$i.$type;
			$is_1='<a href="'.$thispagelink.'">';
			$is_2="</a>";
		}
		$returnstr.='&nbsp;'.$is_1.$i.$is_2;
	}
	$returnstr=$firststr.$toppage.$prepage.$returnstr.$nextpage.$lastpage;
	$pager['showpage']=$returnstr;
	return $pager;
}
?>

方法三:修改帝國核心配置文件(不推薦)

難度中等:修改php文件中的html結構,通過結構適配css代碼。

不建議原因:核心文件,能不修改,則不修改

評論表單

<script>
		  function CheckPl(obj)
		  {
		  if(obj.saytext.value=="")
		  {
		  alert("您沒什麼話要說嗎?");
		  obj.saytext.focus();
		  return false;
		  }
		  return true;
		  }
		  </script><form action="[!--news.url--]e/pl/doaction.php" method="post" name="saypl" id="saypl" onsubmit="return CheckPl(document.saypl)">
<table width="100%" border="0" cellpadding="0" cellspacing="0" id="plpost">

<tr>
<td><table width="100%" border="0" cellpadding="0" cellspacing="0" class="title">
<tr>
<td><strong>發表評論</strong></td>
<td align="right"><a href="[!--news.url--]e/pl/?classid=[!--classid--]&amp;id=[!--id--]">共有<span><script type="text/javascript" src="[!--news.url--]e/public/ViewClick/?classid=[!--classid--]&id=[!--id--]&down=2"></script></span>條評論</a></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="10" cellpadding="0">
<tr>
<td><table width="100%" border="0" cellpadding="0" cellspacing="2">
<tr>
<td width="56%" align="left">用戶名:
<input name="username" type="text" class="inputText" id="username" value="" size="16" /></td>
<td width="44%" align="left">密碼:
<input name="password" type="password" class="inputText" id="password" value="" size="16" /></td>
</tr>
<tr>
<td align="left">驗證碼:
<input name="key" type="text" class="inputText" size="10" />
<img src="[!--news.url--]e/ShowKey/?v=pl" align="absmiddle" name="plKeyImg" id="plKeyImg" onclick="plKeyImg.src='[!--news.url--]e/ShowKey/?v=pl&t='+Math.random()" title="看不清楚,點擊刷新" /> </td>
<td align="left"><input name="nomember" type="checkbox" id="nomember" value="1" checked="checked" />
匿名發表</td>
</tr>
</table>
<textarea name="saytext" rows="6" id="saytext"></textarea><input name="imageField" type="image" src="[!--news.url--]e/data/images/postpl.gif"/>
<input name="id" type="hidden" id="id" value="[!--id--]" />
<input name="classid" type="hidden" id="classid" value="[!--classid--]" />
<input name="enews" type="hidden" id="enews" value="AddPl" />
<input name="repid" type="hidden" id="repid" value="0" />
<input type="hidden" name="ecmsfrom" value="[!--titleurl--]"></td>
</tr>
</table>
</td>
</tr>
</table></form>

 

微信赞赏

微信

支付宝赞赏

支付寶

✍️ 作者: 紅穆

網站管理員 · 感謝閱讀,更多精彩內容敬請關注

作者主頁 查看主頁 →

相關文章

帝国CMS数据库语句&amp;SQL语句格式

帝國CMS數據庫語句&amp;SQL語句格式 程序筆記 帝國cms

帝國CMS擴展SQL程序編寫介紹,帝國CMS數據庫語句&SQL語句格式基本範例:說明:下面例子都是以PHP文件放在系統根目錄爲基準。例1:連接MYSQL程序。(a.php)&lt;?php require('e/class/connect.php'); //引入數據庫配置文件和公共函數文件 requ…
👁 680
帝国CMS获取系统COOKIE变量函数getcvar()

帝國CMS獲取系統COOKIE變量函數getcvar() 程序筆記 帝國cms

取得系統COOKIE變量函數語法:getcvar($var,$ecms)說明:$var:爲變量名$ecms:0爲設置前臺COOKIE變量,1爲設置後臺COOKIE變量。此參數可省略,默認爲0。使用範例:getcvar('mlusername'),取得前臺登陸會員的用戶名getcvar('loginu…
👁 574
帝国CMS灵动标签调用字段大全

帝國CMS靈動標籤調用字段大全 程序筆記 帝國cms

將所有支持靈動標籤調用的字段收集歸類帝國CMS靈動標籤: [e:loop={欄目ID/專題ID,顯示條數,操作類型,只顯示有標題圖片,附加SQL條件,顯示排序}] 模板代碼內容 [/e:loop]調用時間:&lt;?=date('m-d',$bqr[newstime])?&gt; &lt;?=dat…
👁 4149

推薦閱讀

PHP file() 函数

PHP file() 函數 語言筆記 PHP

定義和用法file() 函數把整個文件讀入一個數組中。與 file_get_contents() 類似,不同的是 file() 將文件作爲一個數組返回。數組中的每個單元都是文件中相應的一行,包括換行符在內。如果失敗,則返回 false。語法file(path,include_path,context…
👁 417
PHP正则里,|如何替换,需要替换的字符串里有|

PHP正則裏,|如何替換,需要替換的字符串裏有| 語言筆記 PHP

在 PHP 中,可以使用 preg_replace() 函數來替換字符串中的製表符。製表符在正則表達式中表示爲 |,要將製表符替換爲其他字符,可以使用 $1 符號來表示替換後的字符,例如:$str = "這是一段 | 字符"; $str = preg_replace('/\|/', '替換後的字符'…
👁 443
(PC+WAP)教育咨询服务类网站pbootcms模板 教育培训出国留学机构网站源码下载 0051

(PC+WAP)教育諮詢服務類網站pbootcms模板 教育培訓出國留學機構網站源碼下載 0051 實用收藏 pbootcms模板

一款針對教育諮詢、出國留學及培訓機構行業的PbootCMS網站模板,同時適配PC和移動端。設計風格簡潔專業,以信息展示爲主。模板內置了留學項目、院校介紹與在線諮詢等模塊,有助於教育服務機構高效搭建品牌官網並獲取潛在客戶。模板展示 安裝說明 網站後臺:/admin.php 賬號:admin 密碼:ad…
👁 372
(自适应手机端)养马场畜牧业英文网站pbootcms模板 马匹饲养养殖场网站模板下载 0235

(自適應手機端)養馬場畜牧業英文網站pbootcms模板 馬匹飼養養殖場網站模板下載 0235 實用收藏 pbootcms模板

本套自適應手機端的養馬場與畜牧業英文PbootCMS網站模板。設計風格自然專業,適合馬匹飼養、繁育場展示養殖環境與馬匹品種。有助於畜牧企業在海外市場進行品牌推廣與產品展示。模板展示 安裝說明 網站後臺:/admin.php 賬號:admin 密碼:admin 解壓密碼:www.4s5.cn相關文章P…
👁 331