<?php
function lib_kaice(&$ctag,&$refObj)
{
	global $dsql;
	
	FillAttsDefault($ctag->CAttribute->Items,$attlist);
	extract($ctag->CAttribute->Items, EXTR_SKIP);
	$innertext = $ctag->GetInnerText();
	$leixing = $leixing;
	$line = empty($row) ? 10 : $row;


if($type=='type')
	{$sql = "select #@__addonkc.leixing,zhuangtai,pingtai,fahao,fahaourl,zhuce,#@__archives.title,id,pubdate from #@__addonkc,#@__archives where #@__addonkc.aid=#@__archives.id and leixing='$leixing' order by pubdate desc limit 0,$line";}

if($type=='recent')
	{$sql = "select #@__addonkc.pingtai,fahaourl,zhuangtai,#@__archives.title,id,pubdate from #@__addonkc,#@__archives where #@__addonkc.aid=#@__archives.id and fahaourl LIKE '%card%' order by pubdate desc limit 0,$line";}
	
  $needRel = false;
	$dtp2 = new DedeTagParse();
	$dtp2->SetNameSpace('field','[',']');
	$dtp2->LoadSource($innertext);
	
	if(empty($sql)) return '';
	$dsql->SetQuery($sql);
	$dsql->Execute();
	for($i=0;$i < $line;$i++)
	{
	if($row=$dsql->GetArray())
    {
	 if($needRel)
	    {
	$row['sonids'] = GetSonIds($row['id'], 0, false);}
	 else{
	 if(is_array($dtp2->CTags))
        {
	foreach($dtp2->CTags as $tagid=>$ctag)
	{
	if(isset($row[$ctag->GetName()])) $dtp2->Assign($tagid,$row[$ctag->GetName()]);
	    } 
	}
	$liketype .= $dtp2->GetResult();
		}
	}			
}

	return $liketype;
}
?>