标签 DEDECMS 下的文章

DedeCms autoindex和itemindex 用法说明,让dedecms autoindex,itemindex 从0到1开始的办法
让dedecms autoindex,itemindex 从0到1开始的办法
[field:global name=autoindex runphp="yes"]@me=@me+1;[/field:global]
{dede:global name=itemindex runphp="yes"}@me=@me+1;{/dede:global}

autoindex itemindex 的使用心得区别
channelartlist 标签下使用 {dede:global name='itemindex' runphp='yes'}@me;{/dede:global}
自增1
arclist 标签下使用 [field:global.autoindex/] 默认从1开始
channel 标签下使用 [field:global.autoindex/] 默认从0开始
channelartlist 标签下使用 {dede:global.itemindex/} 默认从1开始

arclist 从0开始[field:global name=autoindex runphp="yes"]@me=@me-1;[/field:global]
channel 从1开始[field:global name=autoindex runphp="yes"]@me=@me+1;[/field:global][field:typename/]
channelartlist 从0开始{dede:global name=itemindex runphp='yes'}@me=@me-1;{/dede:global}

<div id="h_pd_lm_{dede:global.itemindex/}" {dede:global name='itemindex' runphp='yes'}@me=(@me==1)?'':'style="display:none;"';{/dede:global} class="pd2_lmc_l1"> 

channelartlist实例

{dede:channelartlist  notypeid='123,124,146,147'}  
<a class="pd2_lmt{dede:global name=itemindex runphp='yes'}@me=(@me==1)?'1':'3';{/dede:global}" onmouseover="showitem2({dede:global name=itemindex runphp='yes'}@me=@me-1;{/dede:global},'pd_lm','h_pd_lm_','pd2_lmt');" href='{dede:field name='typeurl'/}'>  
{dede:php}if($refObj->Fields['ispart']){echo $refObj->Fields['typename'];}{/dede:php}  
</a>  
{/dede:channelartlist}

标签下使用 [field:global name=autoindex/]
channel实例

{dede:channel titlelen='32'}  
<li [field:global name='autoindex' runphp='yes']if(@me%2==0){@me='class="rr"';}else{@me='';}[/field:global] ><h3><a href='[field:typelink/]'>[field:typename/]</a></h3></li>  
{/dede:channel}

在arclist中使用autoindex runphp 时用这种方式:

{dede:arclist titlelen='22' row='4' flag='c' orderby='id'}  
<a href="[field:arcurl /]" target="_blank">[field:title /]</a>  
[field:global name='autoindex' runphp='yes']if(@me==2){@me="<br />";}else{@me=' ';}[/field:global]{/dede:arclist}

自增1
[field:global.autoindex/]
arclist实例

{dede:arclist channelid=17 row=6 orderby=pubdate titlelen=40 addfields='docphoto,docjob,doctec' typeid='123,136,146,155,172,182,202'}  
<div id="h_nrr_zj_[field:global.autoindex/]" class="nrr_zjl" [field:global name='autoindex' runphp='yes']if(@me==1){@me="";}else{@me='style="display:none;"';}[/field:global] >  
 <div><a href="[field:arcurl/]" title="[field:fulltitle/]" target="_blank"><img src="[field:litpic/]" alt="[field:fulltitle/]" /></a></div>  
</div>  
{/dede:arclist}

如何自由定义 开始的数字
autoindex/itemindex 可以使用 @me+1;实现由指定数字开始
遇到类似的问题做下这个笔记,在用到的时候可以灵活发挥!
list 标签下试用autoindex

{dede:list pagesize='40' orderby='id'}  
[field:global name='autoindex' runphp='yes']if(@me%10==0){@me="test";}else{@me='';}[/field:global]   
{/dede:list}

今天在做项目的时候遇到问题,要获取上一篇、下一篇的URL地址,系统默认是带链的,要的效果是这样的。 "/anzhuang/2011/1012/555.html"
代码如下:
上一篇地址
{dede:prenext get='pro' runphp="yes"}
preg_match_all('/<a.*?(?: |\\t|\\r|\\n)?href=[\'"]?(.+?)[\'"]?(?:(?: |\\t|\\r|\\n)+.*?)?>(.+?)<\/a.*?>/sim', @me, $strResult, PREG_PATTERN_ORDER);
@me=$strResult[1][0];
{/dede:prenext}
下一篇地址
{dede:prenext get='next' runphp="yes"}
preg_match_all('/<a.*?(?: |\\t|\\r|\\n)?href=[\'"]?(.+?)[\'"]?(?:(?: |\\t|\\r|\\n)+.*?)?>(.+?)<\/a.*?>/sim', @me, $strResult, PREG_PATTERN_ORDER);
@me=$strResult[1][0];
{/dede:prenext}

[field:pubdate function=GetDateMK(@me)/] 2009-11-10
[field:pubdate function=GetDateTimeMK(@me)/] 2009-11-10 12:20:20
[field:pubdate function="GetDateMK(@me)"/] 2009-11-10
[field:pubdate function="GetDateTimeMK(@me)"/] 2009-11-10 12:20:20
[field:pubdate function=MyDate('m-d',@me)/] 11-10
{dede:field.pubdate function="MyDate('Y-m-d H:i',@me)"/} 2009-11-10 12:20

标签名称:arclist
标记简介:织梦常用标记,也称为自由列表标记,其中imglist、imginfolist、specart、coolart、autolist都是由该标记所定义的不同属性延伸出来的别名标记。
功能说明:获取指定文档列表
适用范围:全局使用
基本语法:

[php]{dede:arclist flag='h' typeid='' row='' col='' titlelen='' infolen='' imgwidth='' imgheight='' listtype='' orderby='' keyword='' limit='0,1'}
<a href='[field:arcurl/]'>[field:title/]</a>
{/dede:arclist}[/php]

参数说明:
col=” 分多少列显示(默以为单列),5.3版中本属性可以通过多种方式进行多行显示
假如col=’1′要多列显示的可用div+css实现
以下为通过div+css实现多列的示例:
[php]
<style type=text/css>
div{width:400px;float:left;}
</style>
{dede:arclist row='10' titlelen='24' orderby='pubdate' idlist='' col='2'}
[field:textlink/]([field:pubdate function=MyDate('m-d',@me)/])<br/>
{/dede:arclist}[/php]

当col>1将使用原来的table多列方式显示
row=’10′ 返回文档列表总数
typeid=” 栏目ID,在列表模板和档案模板中一般不需要指定,在首页模板中答应用”,”分开表示多个栏目;
getall=’1′ 在没有指定这属性的情况下,在栏目页、文章页模板,不会获取以”,”分开的多个栏目的下级子类
titlelen = ’30′ 标题长度 等同于titlelength
infolen=’160′ 表示内容简介长度 等同于infolength
imgwidth=’120′ 缩略图宽度
imgheight=’90′ 缩略图高度
listtype=’all’ 栏目类型 image含有缩略图 commend推荐
orderby=’sortrank’ 文档排序方式
§ orderby=’hot’ 或 orderby=’click’ 表示按点击数排列
§ orderby=’sortrank’ 或 orderby=’pubdate’ 按出版时间排列
§ orderby=’near’
§ orderby==’lastpost’ 按最后评论时间
§ orderby==’scores’ 按得分排序
§ orderby=’id’ 按文章ID排序
§ orderby=’rand’ 随机获得指定条件的文档列表
keyword=” 含有指定关键字的文档列表,多个关键字用”,”分
innertext = ” 单条记录样式
aid=” 指定文档ID
idlist =” 提取特定文档(文档ID)
channelid 频道ID
limit=’起始ID,记录数’ (起始ID从0开始)表示限定的记录范围(如:limit=’1,2′ 表示从ID为1的记录开始,取2条记录)
flag = ‘h’ 自定义属性值:头条[h]推荐

[php][/c][/php]

图片[p]幻灯[f]转动[s]跳转[j]图文[a]加粗
noflag = ” 同flag,但这里是表示不包含这些属性
orderway=’desc’ 值为 desc 或 asc ,指定排序方式是降序还是顺向排序,默以为降序
subday=’天数’ 表示在多少天以内的文档

实例解析:

1, 基本应用
标签调用:

[php]{dede:arclist orderby=pubdate titlelen='26' row='10'}
<ul>
<li><a href="[field:arcurl/]">[ field:title /]</a></li>
</ul>
{/dede:arclist}[/php]

标签解释:
row=’10′:表示调用10条文章标题。
titlelen=’26′:表示每条标题字数控制在26个字符,2个字符为一个汉字。
orderby=pubdate:表示文档排序方式为按最新发布时间排序。
排序方式还可以选择:
orderby=’sortrank’ 文档排序方式
§ orderby=’hot’ 或 orderby=’click’ 表示按点击数排列
§ orderby=’sortrank’ 或 orderby=’pubdate’ 按出版时间排列
§ orderby=’near’
§ orderby==’lastpost’ 按最后评论时间
§ orderby==’scores’ 按得分排序
§ orderby=’id’ 按文章ID排序
§ orderby=’rand’ 随机获得指定条件的文档列表

2, 调用文章标题和文章摘要

标签调用:

[php]{dede:arclist orderby=pubdate titlelen='26' row='10'}
<ul>
<li><a href="[field:arcurl/]">[ field:title /]</a></li>
<p><font color="#FF0000">文章摘要:</font>[field:description/]..</p>
</ul>
{/dede:arclist}[/php]

标签解释:
这段代码和基本应用部分对比,多出了[field:description/]标签部分,此标签表示调用的是文章摘要部分
[field:description/]控制字数写法[field:description function='cn_substr(@me,80)'/]其中标签内的80即代表每次调用摘要所需字符数

3, 调用标题加摘要加缩略图

标签调用:

[php]{dede:arclist orderby=pubdate titlelen='26' row='10' type='image.' imgwidth='94' imgheight='84'}
<ul>
<li><a href="[field:arcurl/]">[ field:title /]</a></li>
<p><span>[field:imglink /]</span><font color="#FF0000">文章摘要:</font>[field:description/]..</p>
</ul>
{/dede:arclist}[/php]

标签解释:
在上述例子的基本上添加了type=’image.’ imgwidth=’94′ imgheight=’84′和[field:imglink /]这两个标签。
其中type=’image.’ imgwidth=’94′ imgheight=’84′表示调用必须是带有缩略图的文章,并缩略图大小控制在宽94px,高84px。
[field:imglink /]标签为带链接的图片标签。
图片标签其它写法:
[field:imglink /]与[field:image/] 是完全等价的,只不过后者更灵活一点,可以在 中添加 title=”"
即[field:image/]

则更为灵活,不仅可以添加title=”",还可以添加 alt=”",但是固然灵活了,缺少了图片的宽度和高度的控制,所以要在CSS中控制图片的大小,适合对CSS有一点了解的人。
4, 调用文章标题,摘要,缩略图和时间

标签调用:

[php]{dede:arclist orderby=pubdate titlelen='26' row='10' type='image.' imgwidth='94' imgheight='84'}
<ul>
<li><a href="[field:arcurl/]">[ field:title /]</a><span style="color:#990000">[field:pubdate function="MyDate('m-d',@me)"/]</span></li>
<p><span>[field:imglink /]</span><font color="#FF0000">文章摘要:</font>[field:description/]..</p>
</ul>
{/dede:arclist}[/php]

标签解释:
在第三个列子的基础上添加了时间标签[php][field:pubdate function="MyDate('m-d',@me)"/][/php]

目录先容:

./dede dede后台
./html 天生栏目对应的文件
./include 类库,配置文件,词库
./member 会员功能
./plus 插件(留言簿,投票。。)
./setup 安装程序目录
./special 专题天生目录
./templets 网站模板目录
./upimg 采集,后者用户上传的附件所在的目录

base.css 基本样式表
index.php 网站默认首页
robots.txt 搜索控制文件

文件先容:

./index.html 由模板天生的html首页文件
./index.php

解析模板,并且显示出首页,
具体代码做个分析:

require_once(dirname(__FILE__).”/include/config_base.php”);
require_once(dirname(__FILE__).”/include/inc_arcpart_view.php”);

//上面两段是调用两个文件一个是基本的配置文件,另一个是是文章类文件

dirname(__FILE__)是当前路径

CODE:

$dsql = new DedeSql(false);
$row = $dsql->GetOne(“Select * From dede_homepageset”);
$dsql->Close();

//SQL语句,查询表dede_homepageset 字段templet (调用哪个模板)

CODE:

$pv = new PartView();
$pv->SetTemplet($cfg_basedir.”/”.$cfg_templets_dir.”/”.$row['templet']);
$pv->Display();
$pv->Close();

//类库调用,

$cfg_basedir.”/”.$cfg_templets_dir.”/”.是路径,

$row['templet']是模板的具体的位置,

然后是$pv->Display();显示模板文件。

============================================

/templets模板目录

/dedecmsv31 3模板目录

/default 默认模板目录

article_article.htm 普通文章页面模板
article_default.htm 一般文档页面模板
article_flash.htm flash页面模板
article_image.htm 图集页面模板
article_soft.htm 软件页面模板
article_spec.htm 专题页面模板
index.htm 网站首页模板
index_article.htm 文章频道封面模板
index_article_webart1.htm
index_article_webart2.htm
index_article_webart.htm
index_default.htm 一般文档封面模板
index_flash.htm flash频道封面模板
index_image.htm 图集频道封面模板
index_soft.htm 软件频道封面模板
list_article.htm 文章列表模板
list_default.htm 一般文档列表目录模板
list_flash.htm flash文档列表模板
list_free.htm 自由列表模板
list_image.htm 图集列表模板
list_soft.htm 软件列表模板
list_spec.htm 专题列表模板

/img 模板图片目录(含样式表)

/plus 辅助插件模板目录
download_links_templet.htm 下载链接模板
feedback_confirm.htm 评论确认模板
feedback_templet.htm 用户评论模板
feedback_templet_js.htm
flink-add.htm 友情链接添加模板
flink-list.htm 友情链接列表模板
guestbook.htm 留言本模板
heightsearch.htm 高级搜索模板
js.htm
recommend.htm 推荐好友模板
rss.htm RSS的XML模板
rssmap.htm RSS订阅文件
showphoto.htm 图片显示模板
sitemap.htm 网站舆图模板
view_msg.htm 会员提示信息模板
vote.htm 投票结果显示模板

/system 系统模板目录

channel_list.htm 栏目列表系统模板
list_fulllist.htm 文档列表系统模板
mynews.htm 站内新闻系统模板
part_arclist.htm 文章列表系统模板
part_autochannel.htm 分类栏目系统模板
part_channelartlist.htm 包含文章列表的栏目系统模板
part_imginfolist.htm 使用imginfolist标签调用的模板
part_imglist.htm 使用imglist标签调用的模板
part_type_list.htm 单个栏目的系统模板
spec_arclist.htm 专题列表文章系统模板
spec_list.htm 专题用模板
tag_arclist.htm
tag_fieldlist.htm fieldlist用系统模板

/system/channel 频道特殊底层模板目录

channel_downlinkpage.htm 下载地址列表链接模板
channel_downlinks.htm 下载地址列表模板
channel_spec_note.htm 专题节点列表模板

/include目录 程序核心目录

config_base.php 环境定义文件。用于检测系统环境,定义工作目录,保存数据库链接信息,引进常用函数等,建议不要修改。
config_hand.php 系统配置文件。定义系统常用的配置信息定义,可从后台治理直接天生该文件。
config_passport.php 通行证文件
config_rglobals.php 检测系统外部变量
config_rglobals_magic.php 同上
inc_archives_view.php 用于浏览文档或对文档天生HTML
inc_arclist_view.php 用于浏览频道列表或对内容列表天生HTML
inc_arcmember_view.php 用于浏览会员发布的文档
inc_arcpart_view.php 用于解析和创建全局性质的模板,如频道封面,主页,单个页面等
inc_arcsearch_view.php 用于文档搜索
inc_arcspec_view.php 用于浏览所有专题列表或对专题列表天生HTML
inc_channel_unit.php 用户解析特定频道的附加数据结构信息
inc_channel_unit_functions.php 系统共用函数集合
inc_downclass.php 防采集随机字符串函数
inc_freelist_view.php 用于对特定内容列表天生HTML
inc_functions.php 可供用户使用的函数集合
inc_imgbt.php GetTypeidSelMember
inc_memberlogin.php 用于用户登录及获得会员状态
inc_photograph.php 用于处理系统中的图片,例如水印,缩略图等
inc_photowatermark_config.php 图片处理参数定义
inc_rss_view.php 用于浏览频道RSS或对RSS天生静态文件
inc_separate_functions.php SpGetArcList函数,用于获得文档列表
inc_sitemap.php 用于天生网站舆图
inc_type_tree.php 用于选择栏目的目录树
inc_type_tree_member.php 同上,会员使用
inc_typelink.php 用于显示文章的位置和栏目位置等
inc_typeunit_admin.php 用于频道治理时的一些复杂操纵,主要用于后台
inc_typeunit_menu.php 同上
inc_userlogin.php 用于治理员登录
inc_vote.php 用于治理投票
jump.php 用于超链接跳转
pub_charset.php 共用字符处理函数,GB/UTF-8/Unicode/BIG5等互换
pub_collection.php 用于采集
pub_collection_functions.php 采集用函数
pub_datalist.php 后台治理用数据列表
pub_datalist_dm.php 同上,不使用模板
pub_db_mysql.php 用于操纵数据库
pub_dedehtml2.php 用于采集中的HTML解析
pub_dedehtml.php HTML解析器
pub_dedetag.php 用于dede模板标签解析
pub_httpdown.php 用于下载http中的资源
pub_oxwindow.php 后台程序扩展
pub_splitword_www.php 织梦分词算法
validateimg.php 验证码
vdimgck.php 验证码

/inc 共用函数目录

inc_fun_funAdmin.php 获取拼音码等函数
inc_fun_funString.php html代码处理等函数
inc_fun_SpGetArcList.php 获取文档列表SpGetArcList