学习商道本领,感悟人生真谛——欢迎来到51搜商网,助您成家立业的网站!
广告
解析织梦dedecms分类信息模型建站
时间:2013-10-20 23:34来源:未知 点 击:
   在经历的大约6个小时的调试后,基本上完成了必要功能的调整。因为织梦这个分类信息模型没有文章模型那么完善,现在把我在建站时遇到的一些主要的问题和解决办法分享给大家,以供参考。

  dedecms分类信息的关键词和描述字段空缺

  dedecms5.7的这个版本在发布分类信息时,貌似没有关键词和描述,这个会导致最后的页面上缺失这2个内容。

  解决办法:

  1.在后台的模型管理中新建2个字段,分别为关键词和描述,模型字段配置(文本模式) 下新增的关键词和描述部分的代码如下:

<field:guanjianci itemname="关键词" autofield="1" notsend="0" type="text" isnull="true" islist="1" default="" maxlength="250" page="">
</field:guanjianci>
<field:miaoshu itemname="描述" autofield="1" notsend="0" type="text" isnull="true" islist="1" default="" maxlength="250" page="">
</field:miaoshu>

  其中上面红色突出标记的是自己新建时自定义的字段(按照系统要求写就OK,可以随便写,首位需要对应),可自行修改此处添加完毕之后,在发布分类信息时就会有需要填写的关键词和描述了,但是页面调用会出错,因为默认的关键词和描述调用如下:

<meta name="keywords" content="{dede:field.keywords/}" />
<meta name="description" content="{dede:field.description function='html2text(@me)'/}" />

  它的字段是与我们新建的不相符的,所以需要修改为如下:

<meta name="keywords" content="{dede:field.guanjianci /}" />
<meta name="description" content="{dede:field.miaoshu /}" />

修改后,你在发表信息时,关键词和描述就会出来啦!

  dedecms分类信息模型上一篇下一篇不显示

  这个也是非常常见的一个问题,大家可能 习惯性的把文章模型的标签拿过来用,实际上在写好标签之后需要修改一个系统文件(路径是 /include/arc.archives.class)

  在里面查找

$next = (is_array($nextR) ? " where arc.id={$nextR['id']} " : ' where 1>2 ');
$pre = (is_array($preR) ? " where arc.id={$preR['id']} " : ' where 1>2 ');
$query = "Select arc.id,arc.title,arc.shorttitle,arc.typeid,arc.ismake,arc.senddate,arc.arcrank,arc.money,arc.filename,
t.typedir,t.typename,t.namerule,t.namerule2,t.ispart,t.moresite,t.siteurl,t.sitepath
from `dede_archives` arc left join dede_arctype t on arc.typeid=t.id ";
 
修改为
$next = $pre = "";
//添加对独立表的支持 by korui
if($this->ChannelUnit->ChannelInfos['issystem']!=-1)
{
$next .= (is_array($nextR) ? " where arc.id={$nextR['id']} " : ' where 1>2 ');
$pre .= (is_array($preR) ? " where arc.id={$preR['id']} " : ' where 1>2 ');
$query = "Select arc.id,arc.title,arc.shorttitle,arc.typeid,arc.ismake,arc.senddate,arc.arcrank,arc.money,arc.filename,
t.typedir,t.typename,t.namerule,t.namerule2,t.ispart,t.moresite,t.siteurl,t.sitepath
from `dede_archives` arc left join dede_arctype t on arc.typeid=t.id ";
}
else
{
$next .= (is_array($nextR) ? " where arc.aid={$nextR['id']} " : ' where 1>2 ');
$pre .= (is_array($preR) ? " where arc.aid={$preR['id']} " : ' where 1>2 ');
$query = "Select arc.aid as id,arc.title,arc.typeid,arc.senddate,arc.arcrank,
t.typedir,t.typename,t.namerule,t.namerule2,t.ispart,t.moresite,t.siteurl,t.sitepath
from `".$this->ChannelUnit->ChannelInfos['addtable']."` arc left join dede_arctype t on arc.typeid=t.id ";
}

  这样分类信息的上下篇文章就可以正常显示啦!

  分类信息模型在列表页和首页调用字段不显示

  这个其实比较好修改,我直接发一段写好的代码,大家参考一下:

{dede:arclistsg typeid='1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18' row='20' titlelen='60' addfields='tel' addfields='linkman,tel' imgwidth='125' imgheight='114' channelid='-8' }
<li style="float:left;width:125;height:114px;overflow:hi"><a href="[field:arcurl/]" class="title" ><span style="margin-right:10px;">[field:image/]</span></a></li>
<li><a href="[field:arcurl/]" class="title" style="color:#316301;">[field:title/]</a><span class="date">[field:pubdate function="GetDateTimeMK(@me)"/]</span>
<p style="line-height:20px;">浏览次数:[field:click/] | 联系人:[field:linkman/] | 联系电话:[field:tel/]</p>
<p style="line-height:20px;margin-right:10px;">房产详情:[field:body function=cn_substr(Html2Text(@me),200)/]...<a href="[field:arcurl/]">[查看全文]</a></p>
</li>
{/dede:arclistsg}

  简单的说一下:

  addfields='linkman,tel' 这段是来控制需要展示的字段的,比如我这需要的联系人和电话

  imgwidth='125' imgheight='114' 这个是来控制输出的缩略图大小尺寸的

  [field:body function=cn_substr(Html2Text(@me),200)/] 这段是我在网上搜索到的,一个无敌的调用摘要的标签,字面上来看应该是截断内容

分享到:
责任编辑:小刀
相关文章
贷款咨询顾问王经理
精彩图文
免责声明|联系我们|广告服务|版权隐私|网站地图||51搜商首页
Copyright © www.51soushang.com 版权所有 Power by DedeCms粤ICP备12044524号