1:更新文件HTML失效
注意:在文章模板中用{dede:php} function a{....} {/dede:php}添加函數(shù)時 "一鍵生成"html
或 "更新文檔HTML" 時 此功能會失效.
2: 生成序列號
[field:global runphp='yes' name=autoindex/]
channelartlist 標簽中 :
{dede:field name='id'/}與{dede:field name='typeid'/} 均表示循環(huán)中的欄目ID;
{dede:global name='itemindex'/} 表示循環(huán)遞增變量,從1開始
{dede:global name='itemparity'/} 表示循環(huán)魔法變量,單數(shù)為1,雙數(shù)為2;
|
3:首頁單獨頁面調(diào)用
單獨頁面調(diào)用
{dede:sql sql="SELECT aid,title,ismake,uptime,filename,likeid FROM
`dede_sgpage` WHERE likeid LIKE '%頁面標識%'"}
|
4:欄目簡介調(diào)用
{dede:sql sql='Select content from dede_arctype where id=30 '}
[field:content function=@cn_substr(@me,長度)]
{/dede:sql}
|
5:首頁單獨頁面內(nèi)容調(diào)用例子
{dede:sql sql="Select LEFT(body,326) as body ,filename from dede_sgpage where
likeid ='cheyouwangjieshao'"}
[field:body function="strip_tags(@me)"/]……
<a href="[field:filename/]" style="color:#FF8915">[詳情]</a>
{/dede:sql}
|
6:模板文件中調(diào)用數(shù)據(jù)庫
方法一:
<?php
$dsql->SetQuery("Select * from dede_area"); //mysql 語句
$dsql->Execute(); //執(zhí)行
while($row = $dsql->GetObject()) //獲取數(shù)據(jù)
{
echo "<option value=".$row->id.">".$row->name."</option>";
}
?>
|
方法二:
$sql = "select *from dede_shops_userinfo where oid='$carts[orders_id]'
$row=$dsql->GetOne($sql);
print_r($row);
[field:id function="addfields(@me , 'mingcheng')"/]
|
7:添加附加表
{dede:arclist addfields='s_time,e_time' flag='p' channelid='17' orderby='pubdate'
titlelen='42' row='8'}
[filed:s_time]..
{/dede:arclist}
|
addfields: 附加字段
channelid:設(shè)置內(nèi)容模型ID
8:調(diào)用dz或其它系統(tǒng)表數(shù)據(jù)方法
{dede:loop table='pre_forum_post' sort='tid' row='9' if=''}
<a href="http://127.0.0.5/forum.php?mod=viewthread&tid=[field:tid /]
target="_blank">[field:subject /]</a>
{/dede:loop}
|
table = '' 查詢表名
sort = '' 用于排序的字段
row = '' 返回結(jié)果的條數(shù)
if = '' 查詢的條件
9:讓其它模塊頁面支持調(diào)用系統(tǒng)標簽
例子:需要再DedeCms的問答系統(tǒng)、留言本、會員空間導(dǎo)航里調(diào)用系統(tǒng)標簽,但默認是不支持系統(tǒng)標
簽調(diào)用的,需要對系統(tǒng)文件進行簡單的修改。
第一步:打開"/include/common.func.php",該文件5.6版本默認存在,5.5的不存在自己建一個。
然后在該文件中加入一個函數(shù),代碼如下:
function pasterTempletDiy($path)
{
require_once(DEDEINC."/arc.partview.class.php");
global $cfg_basedir,$cfg_templets_dir;
$tmpfile = $cfg_basedir.$cfg_templets_dir."/".$path;//模版文件的路徑
$dtp = new PartView();
$dtp->SetTemplet($tmpfile);
$dtp->Display();
}
|
第二步,打開留言本的模版文件,默認的是/templets/plus/guestbook.htm
用以下代碼替換原因的調(diào)用頭部代碼
<?php pasterTempletDiy("default/head.htm"); ?>
DedeCms的問答及會員空間導(dǎo)航,按上邊的方法即可。
10: arclist 標簽開啟權(quán)重排序isweight="Y" orderby="weight"
{dede:arclist typeid="8" flag="c,p" limit="0,4" isweight="Y" orderby="weight"}
{/dede:arclist}
11 dede:list 標簽調(diào)用自定義字段
在模型管理->字段->前臺參數(shù)-> 使字段可以在列表底層模板中獲得.
12: DEDECMS5.7密碼還原到:admin
Update `dede_admin` set pwd='f297a57a5a743894a0e4' where userid='admin'
13: FF 、谷歌瀏覽器上傳圖集報302:
在include/userlogin.class.php文件中的第二行session_start();前面加上
if(isset($_POST["PHPSESSID"]))
{
session_id($_POST["PHPSESSID"]);
}
else if (isset($_GET["PHPSESSID"]))
{
session_id($_GET["PHPSESSID"]);
}
|