文件位置
- php集成环境中新建项目文件夹demo,destoon默认文件复制进项目文件
- 安装 127.0.0.1/demo/install
- 静态文件(img/css/js):demo->skin->demoskin
- 网页文件:demo->template->demotpe
- 首页:demo->template->demotpe->index.htm
- 公共部分:demo->template->demotpe->footer.htm
- 模块首页:demo->template->demotpe->article->index.htm
- 列表页(分类):demo->template->demotpe->article->list.htm
- 详情页:demo->template->demotpe->article->show.htm
- 翻页:demo->template->demotpe->tag->list-tag.htm
- 单页:demo->template->demotpe->extend->webpage.htm
公共部分
-
引用文件前缀
//PC端 <link type="text/css" rel="stylesheet" href="{DT_SKIN}css/common.css"> <script type="text/javascript" src="{DT_SKIN}js/index.js"></script> <img src="{DT_SKIN}img/logo.png">
-
tdk
<title> {if $seo_title}{$seo_title}{else}{if $head_title}{$head_title}{$DT[seo_delimiter]}{/if}{if $city_sitename}{$city_sitename}{else}{$DT[sitename]}{/if}{/if}</title> {if $head_keywords} <meta name="keywords" content="{$head_keywords}" /> {/if} {if $head_description} <meta name="description" content="{$head_description}" /> {/if}
-
调用公共部分
{template 'header'}
-
调用模块目录(导航栏)
{loop $MODULE $m}{if $m[ismenu]} <li><a href="{$m[linkurl]}" target="_blank">{$m[name]}</a></li> {/if}{/loop}
-
当前位置(调用模块链接)
<a href="/">首页</a>> <a href="/{$MOD[moduledir]}">{$MOD[name]}</a>> //模块链接 <a href="/{$MOD[moduledir]}/{$CAT[linkurl]}">{$CAT[catname]}</a> //模块分类链接
-
调用二级分类三级栏目
{loop $MODULE $m}{if $m[ismenu]} {php $child = get_maincat(0, $m[moduleid], 1);} {if $child!=null} {loop $child $i $t} <li> <div class="tanchu"> <span><a href="{$m[linkurl]}{$t[linkurl]}" target="_blank">{$t[catname]}</a></span> </div> <div class="menu-box"> <div class="menu-nav"> {php $a = get_maincat($t[catid], $CATEGORY, 1);} {php $f = get_maincat($t[catid], $CATEGORY, 1);} {loop $f $i $b} <dl class="menu-list"> <dt><a href="{$m[linkurl]}{$b[linkurl]}">{$b[catname]}</a></dt> </dl> {/loop} </div> </div> </li> {/loop} {/if} {/if}{/loop}
-
常用判断
<li class="item {if $m[moduleid]==$moduleid} active {/if}" > <span>{if $copyfrom!=''}{$copyfrom}{else}{$CAT[catname]}{/if}</span>
-
常用排序方法:
添加时间降序:addtime desc,倒序:addtime asc
修改时间降序:edittime desc ,倒序: edittime asc
推荐级别降序:level desc,倒序:level asc -
当前时间
date('Y-m-d h:m:s', time())
-
默认图片
<image src="{$t[thumb]}" onerror="this.src='/skin/xxx/picture/noimg.png';this.οnerrοr=null" />
-
调取资讯内容第一张图作为标题图
修改module\article\admin\template\edit.tpl.php原<input name="post[thumb_no]" type="text" size="2" value=""/> 换成 <input name="post[thumb_no]" type="text" size="2" value="<?php if($thumb_no=="") {?>1<?php } ?>"/>
-
导航栏高亮
<ul class="clearfix" style="width: 503px;"> <li {if $moduleid<4} class="on" {/if}> <a href="{$MODULE[1][linkurl]}"> <span>首页</span> </a> </li> {loop $MODULE $m}{if $m[ismenu]} <li{if $m[moduleid]==$moduleid} class="on" {/if}> <a href="{$m[linkurl]}" <span{if $m[style]} style="color:{$m[style]};"{/if}>{$m[name]}</span> </a> </li> {/if}{/loop} </ul>
-
系统名字
<a title="{$DT[sitename]}">{$DT[sitename]}</a>
首页
-
调用模块(文章)信息
<!--{php $t1=tag("moduleid=23&condition=status=3&order=addtime desc&pagesize=8&template=null");}--> {loop $t1 $i $t} <p>{$t[title]}</p> //标题 <p>{$t[introduce]}</p> //简介 <p>{dsubstr($t[introduce], 80, '...')}</p> //截取80字符的简介 <P>{date('Y-m-d', $t[addtime])}</P> //添加时间 <p>{timetodate($t[addtime],'Y-m-d')}</p> <p>{$t[copyfrom]}</p> //来源 <p>{$t[hits]}</p> //浏览量 <a href="{$t[linkurl]}"></a> <img src="{$t[thumb]}" /> {/loop} **所属分类栏目加showcat=1** <!--{php $t1=tag("moduleid=23&condition=status=3&showcat=1&order=addtime desc&pagesize=8&template=null");}--> {loop $t1 $i $t} <a href="{$t[caturl]}">{$t[catname]}</a> //所属栏目名称 {/loop} **从第几个开始调加 offset=4** <!--{php $tags = tag("moduleid=21&length=36&showcat=1&condition=status=3 and thumb!=''&pagesize=6&offset=6&order=addtime desc&template=null");}-->
模块首页
- 当前模块名称
{$MOD[name]}
- 当前模块分类
{php $child = get_maincat(0, $moduleid, 1);} //当前模块分类 {if $child!=null} {loop $child $i $t} <a href="/{$MOD[moduledir]}/{$t[linkurl]}">{$t[catname]}</a> {/loop} {/if}
分类页(list)
- 当前位置
<a href="/">首页</a>><a href="{$MOD[linkurl]}">{$MOD[name]}</a> <i>></i> {cat_pos($CAT, ' <i>></i> ')}
- 当前分类内容
**当前分类栏目内容** catid=$catid
- 当前分类
{$CAT[catname]}
- 调用翻页
//list页 <!--{tag("moduleid=$moduleid&$dtype&catid=$catid&condition=status=3&$condition&pagesize=13&showcat=1&page=$page&showpage=1&datetype=5&order=addtime desc&template=list-tag")}--> //list-tag页 {loop $tags $i $t} {$t[title]} {/loop} <div class="pages"> <span class="pagingUl"> {if $showpage && $pages} <a>{$pages}</a> {/if} </span> </div>
详情页
-
内容调用
{$title} {$username} 会员名 {date('Y-m-d', $addtime)} {$introduce} {$content}
-
上下篇
<span>上一篇:</span> <!--{tag("moduleid=$moduleid&condition=status=3 and addtime<$addtime&areaid=$cityid&pagesize=1&order=addtime desc&template=list-np", -1)}--> <span>下一篇:</span> <!--{tag("moduleid=$moduleid&condition=status=3 and addtime>$addtime&areaid=$cityid&pagesize=1&order=addtime asc&template=list-np", 1)}-->
单页