请教织梦dedecms采集相关问题
1进入专题管理界面,点击添加专题,出现界面如下:
2然后把“专题名称”,“主分类”,“关键字”,“专题简介”等相关信息填写好,这里的主分类,其实就是要把这个专题放在哪个栏目里,,反正根据自己的需要来设定就行。如果为了展示的效果,还可以在“缩略图”这个地方,给这个专题增加一个缩略,添加的方法。至于“专题模板”,dedecms自带了一个模板,默认名称叫“article_spechtm”但是大部分人都不用默认,因为基本没人用默认的模板。
3以上信息都填写好了以后,点击旁边的“专题文档”,就进入选择文章的环节。
4“节点名称”其实就是这个专题下的分类名称,选择“节点文章”就是对应这个分类,想展示的文章内容。
点击“节点文章”后,会谈出一个对话框,对话框是网站里的所有文章,为了方便选择,可以使用右下角的“搜索”,输入要的关键词,展示网站里的文章,勾选你要的文章以后,点击“把选定值加到列表”,内容就选定了。
5选好了内容,文章ID选定,确定以后的界面如下:
6下面的节点2、3、4……以此类推,来选择自己的文章。都弄好了以后,确定就可以发布专题了。但是如果模板路径/templets/default/下面没有article_spechtm这个模板文件,是不能发布专题的。
一、修改文件:\include\taglib目录下的channellibphp,请将以下代码全部复制替换上述文件
<phpfunction lib_channel(&$ctag,&$refObj)
{
global $_sys_globals,$envs,$dsql;
$attlist = "typeid|0,reid|0,row|100,col|1,type|son,currentstyle|";
FillAttsDefault($ctag->CAttribute->Items,$attlist);
extract($ctag->CAttribute->Items, EXTR_SKIP);
$innertext = $ctag->GetInnerText();
$cacheid = trim($cacheid);
if($cacheid !='') {
$likeType = GetCacheBlock($cacheid);
if($likeType != '') return $likeType;
}
$reid = 0;
$topid = 0;
if(empty($typeid) && $envs['typeid']!=0)
{
$typeid = $envs['typeid'];
$reid = $envs['reid'];
}else{
$reid=0;
}
if($type==''||$type=='sun') $type="son";
if($innertext=='') $innertext = GetSysTemplets("channel_listhtm");
if($reid==0 && $typeid>0)
{
$dbrow = $dsql->GetOne("Select reid From dede_arctype where id='$typeid' ");
if(is_array($dbrow)) $reid = $dbrow['reid'];
}
$likeType = '';
if($type=='top')
{
$sql = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description
From dede_arctype where reid=0 And ishidden<>1 order by sortrank asc limit 0,$row";
}
else if($type=="son")
{
//if($_sys_globals['typeid']>0) $typeid = $_sys_globals['typeid'];
if($typeid==0) {
return '';
}
$sql = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description
From dede_arctype where reid='$typeid' And ishidden<>1 order by sortrank asc limit 0,$row";
}
else if($type=="self")
{
if($reid==0) {
return '';
}
$sql = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description
From `dede_arctype` where reid='$reid' And ishidden<>1 order by sortrank asc limit 0,$row";
}
//And id<>'$typeid'
$needRel = false;
$dtp2 = new DedeTagParse();
$dtp2->SetNameSpace("field","[","]");
$dtp2->LoadSource($innertext);
$dsql2 = clone $dsql;
$dsql->SetQuery($sql);
$dsql->Execute();
$line = $row;
//检查是否有子栏目,并返回rel提示(用于二级菜单)
if(ereg(':rel', $innertext)) $needRel = true;
if(empty($sql)) return '';
$dsql->SetQuery($sql);
$dsql->Execute();
$totalRow = $dsql->GetTotalRow();
$GLOBALS['autoindex'] = 0;
for($i=0;$i < $line;$i++)
{
if($col>1) $likeType = "<dl>\r\n";
for($j=0;$j<$col;$j++)
{
if($col>1) $likeType = "<dd>\r\n";
if($row=$dsql->GetArray())
{
$row['sonids'] = $row['rel'] = '';
if($needRel)
{
$row['sonids'] = GetSonIds($row['id'], 0, false);
if($row['sonids']=='') $row['rel'] = '';
else $row['rel'] = " rel='dropmenu{$row['id']}'";
}
//处理同级栏目中,当前栏目的样式
if( ($row['id']==$typeid || ($topid==$row['id'] && $type=='top') ) && $currentstyle!='' )
{
if($currentstyle!='')
{
$linkOkstr = $currentstyle;
$row['typelink'] = GetOneTypeUrlA($row);
$linkOkstr = str_replace("~rel~",$row['rel'],$linkOkstr);
$linkOkstr = str_replace("~id~",$row['id'],$linkOkstr);
$linkOkstr = str_replace("~typelink~",$row['typelink'],$linkOkstr);
$linkOkstr = str_replace("~typename~",$row['typename'],$linkOkstr);
$likeType = $linkOkstr;
}
}else
{
$row['typelink'] = $row['typeurl'] = GetOneTypeUrlA($row);
if(is_array($dtp2->CTags))
{
foreach($dtp2->CTags as $tagid=>$ctag){
if(isset($row[$ctag->GetName()]))
{
$dtp2->Assign($tagid,$row[$ctag->GetName()]);
}
elseif (preg_match('/^sonchannel[0-9]$/',$ctag->GetName()))
{
$dtp2->Assign($tagid,lib_channel_son($ctag,$row['id'],$dsql2));
}
}
}
$likeType = $dtp2->GetResult();
}
}
if($col>1) $likeType = "</dd>\r\n";
$GLOBALS['autoindex']++;
}//Loop Col
if($col>1)
{
$i += $col - 1;
$likeType = " </dl>\r\n";
}
}//Loop for $i
reset($dsql2);
$dsql->FreeResult();
return $likeType;
}
function lib_channel_son($ctag,$typeid = 0,$dsql2)
{
$attlist = "row|100,col|1,currentstyle|";
FillAttsDefault($ctag->CAttribute->Items,$attlist);
extract($ctag->CAttribute->Items, EXTR_SKIP);
$innertext = $ctag->GetInnerText();
$dsql3 = clone $dsql2;
$likeType = '';
//if($_sys_globals['typeid']>0) $typeid = $_sys_globals['typeid'];
if($typeid==0) {
return '';
}
$sql = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description
From dede_arctype where reid='$typeid' And ishidden<>1 order by sortrank asc limit 0,$row";
//And id<>'$typeid'
$dtp2 = new DedeTagParse();
$dtp2->SetNameSpace("field","[","]");
$dtp2->LoadSource($innertext);
$dsql2->SetQuery($sql);
$dsql2->Execute();
$line = $row;
for($i=0;$i < $line;$i++)
{
if($col>1) $likeType = "<dl>\r\n";
for($j=0;$j<$col;$j++)
{
if($col>1) $likeType = "<dd>\r\n";
if($row=$dsql2->GetArray())
{
$row['typelink'] = $row['typeurl'] = GetOneTypeUrlA($row);
if(is_array($dtp2->CTags))
{
foreach($dtp2->CTags as $tagid=>$ctag){
if(isset($row[$ctag->GetName()]))
{
$dtp2->Assign($tagid,$row[$ctag->GetName()]);
}
elseif (preg_match('/^sonchannel[0-9]$/',$ctag->GetName()))
{
$dtp2->Assign($tagid,lib_channel_son($ctag,$row['id'],$dsql3));
}
}
}
$likeType = $dtp2->GetResult();
}
if($col>1) $likeType = "</dd>\r\n";
}//Loop Col
if($col>1)
{
$i += $col - 1;
$likeType = " </dl>\r\n";
}
}//Loop for $i
reset($dsql3);
$dsql2->FreeResult();
return $likeType;
}
>
二、在模板调用
实例:
{dede:channel type='son' typeid='改成你的大栏目ID'}[field:typename/]
<ul>
[field:sonchannel0]
<li><a href="[field:typelink/]">[field:typename/]</a></li>
[field:sonchannel1]
<li><a href="[field:typelink/]">---[field:typename/]</a></li>
[field:sonchannel2]
<li><a href="[field:typelink/]">===[field:typename/]</a></li>
[field:sonchannel3]
<li><a href="[field:typelink/]">===[field:typename/]</a></li>
[/field:sonchannel3]
[/field:sonchannel2]
[/field:sonchannel1]
[/field:sonchannel0]
</ul>
{/dede:channel}
模板调用 [field:sonchannel0] [/field:sonchannel0] 这个是用来取子栏目用的(使用[sonchannel+数字] 作为标签名是为了防止嵌套的时候无法正确解析标签)
这个的作用就是当你的栏目有很多子栏目 无限分级的时候方便你取子栏目的。
更新 622
来源,以及作者跟原文章有关,原文章没有写就不会有的。
这个采集成功率大概有95%,采集不了就只能手动添加了,不是很多。
BASE64:e2RlZGU6bGlzdGNvbmZpZ30NCntkZWRlOm5vdGVpbmZvIG5vdGVuYW1lPSJiYrLJvK8iIGNoYW5uZWxpZD0iMSIgbWFjdGh0eXBlPSJzdHJpbmciDQoJcmVmdXJsPSJodHRwOi8vIiBzb3VyY2VsYW5nPSJ1dGYtOCIgY29zb3J0PSJhc2MiDQogIGlzcmVmPSJubyIgZXhwdGltZT0iMTAiIHVzZW1vcmU9IjAiIC99DQp7ZGVkZTpsaXN0cnVsZSBzb3VyY2V0eXBlPSJiYXRjaCIgcnNzdXJsPSJodHRwOi8vIiByZWd4dXJsPSJodHRwOi8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XSopPnsvZGVkZTp0cmltfQ0Ke2RlZGU6dHJpbSByZXBsYWNlPSIifTwvZGl2PnsvZGVkZTp0cmltfQ0Ke2RlZGU6dHJpbSByZXBsYWNlPSIifTxhKFtePl0qKT4oLiopPC9hPnsvZGVkZTp0cmltfQ0Ke2RlZGU6dHJpbSByZXBsYWNlPSIifX08cD57L2RlZGU6dHJpbX0NCiAgIHtkZWRlOmZ1bmN0aW9ufQ0KDQoNCg0KDQoNCg0KDQoNCg0KDQoNCg0KDQoNCg0KDQoNCg0KDQoNCg0KDQoNCg0KDQoNCg0KDQoNCg0KDQoNCg0KDQoNCg0KDQoNCnsvZGVkZTpmdW5jdGlvbn0NCnsvZGVkZTppdGVtfQ0Key9kZWRlOml0ZW1jb25maWd9:END
{dede:arclist typeid='' orderby='pubdate' titlelen=34 row=10}
<li><a target="_blank" href="[field:arcurl /]">[field:title/]</a></li>
{/dede:arclist}
orderby='pubdate' 按出版时间排列
orderby='' 表示排序方式,默认值是 senddate 按发布时间排列。
orderby='hot' 或 orderby='click' 表示按点击数排列
typeid='' 为空 表示调用当前栏目最新文章
楼主可以试试看看 行就给分吧 更多请关注百度空间:http://wwwbaiducom/p/疯子小组
要调用某个栏目的下级栏目名称,参考下面的标签
{dede:channel row='20' type ='son' typeid ='2' } 此处是底层标签 {/dede:channel}
row='20'表示调用20个栏目名称
type ='son'表示调用下级栏目
typeid ='2'表示父栏目id为2
关于底层标签,诸如栏目名称,链接等等就不再赘述了吧
0条评论