1:更新文件HTML失效 注意:在文章模板中用{dede:php} function a{....} {/dede:php}添加函数时 一键生成html 或 更新文档HTML 时 此功能会失效. 2: 生成序列号 1 [field:global runphp= yes name=autoindex/] 2 3 channelartlist 标签中 : 4 {dede:field name
1:更新文件HTML失效
注意:在文章模板中用{dede:php} function a{....} {/dede:php}添加函数时 "一键生成"html
或 "更新文档HTML" 时 此功能会失效.
2: 生成序列号
1 |
[field:global runphp='yes' name=autoindex/] |
4 |
{dede:field name='id'/}与{dede:field name='typeid'/} 均表示循环中的栏目ID; |
5 |
{dede:global name='itemindex'/} 表示循环递增变量,从1开始 |
6 |
{dede:global name='itemparity'/} 表示循环魔法变量,单数为1,双数为2; |
|
3:首页单独页面调用
单独页面调用
1 |
{dede:sql sql="SELECT aid,title,ismake,uptime,filename,likeid FROM |
3 |
`dede_sgpage` WHERE likeid LIKE '%页面标识%'"} |
|
4:栏目简介调用
1 |
{dede:sql sql='Select content from dede_arctype where id=30 '} |
3 |
[field:content function=@cn_substr(@me,长度)] |
|
5:首页单独页面内容调用例子
1 |
{dede:sql sql="Select LEFT(body,326) as body ,filename from dede_sgpage where |
3 |
likeid ='cheyouwangjieshao'"} |
5 |
[field:body function="strip_tags(@me)"/]…… |
6 |
<a href="[field:filename/]" style="color:#FF8915">[详情]</a> |
|
6:模板文件中调用数据库
方法一:
03 |
$dsql->SetQuery("Select * from dede_area"); //mysql 语句 |
05 |
$dsql->Execute(); //执行 |
07 |
while($row = $dsql->GetObject()) //获取数据 |
11 |
echo "<option value=".$row->id.">".$row->name."</option>"; |
|
方法二:
1 |
$sql = "select *from dede_shops_userinfo where oid='$carts[orders_id]' |
3 |
$row=$dsql->GetOne($sql); |
7 |
[field:id function="addfields(@me , 'mingcheng')"/] |
|
7:添加附加表
1 |
{dede:arclist addfields='s_time,e_time' flag='p' channelid='17'orderby='pubdate' |
|
addfields: 附加字段
channelid:设置内容模型ID
8:调用dz或其它系统表数据方法
1 |
{dede:loop table='pre_forum_post' sort='tid' row='9' if=''} |
3 |
<a href="http://127.0.0.5/forum.phpmod=viewthread&tid=[field:tid /] |
5 |
target="_blank">[field:subject /]</a> |
|
table = '' 查询表名
sort = '' 用于排序的字段
row = '' 返回结果的条数
if = '' 查询的条件
9:让其它模块页面支持调用系统标签
例子:需要再DedeCms的问答系统、留言本、会员空间
导航里调用系统标签,但默认是不支持系统标
签调用的,需要对系统文件进行简单的修改。
第一步:打开"/include/common.func.php",该文件5.6版本默认存在,5.5的不存在自己建一个。
然后在该文件中加入一个函数,代码如下:
01 |
function pasterTempletDiy($path) |
04 |
require_once(DEDEINC."/arc.partview.class.php"); |
06 |
global $cfg_basedir,$cfg_templets_dir; |
08 |
$tmpfile = $cfg_basedir.$cfg_templets_dir."/".$path;//模版文件的路径 |
10 |
$dtp = new PartView(); |
12 |
$dtp->SetTemplet($tmpfile); |
|
第二步,打开留言本的模版文件,默认的是/templets/plus/guestbook.htm
用以下代码替换原因的调用头部代码
<php pasterTempletDiy("default/head.htm"); >
DedeCms的问答及会员空间导航,按上边的方法即可。
10: arclist 标签开启权重排序isweight="Y" orderby="weight"
{dede:arclist typeid="8" flag="c,p" limit="0,4" isweight="Y" orderby="weight"}
{/dede:arclist}
11 dede:list 标签调用自定义字段
在模型管理->字段->前台参数-> 使字段可以在列表底层模板中获得.
12: DEDECMS5.7密码还原到:admin
Update `dede_admin` set pwd='f297a57a5a743894a0e4' where userid='admin'
13: FF 、谷歌浏览器上传图集报302:
在include/userlogin.class.php文件中的第二行session_start();前面加上
01 |
if(isset($_POST["PHPSESSID"])) |
04 |
session_id($_POST["PHPSESSID"]); |
07 |
else if (isset($_GET["PHPSESSID"])) |
10 |
session_id($_GET["PHPSESSID"]); |
|