<?php
if(!defined('DEDEINC'))
{
	exit("Request Error!");
}
function lib_likepage(&$ctag,&$refObj)
{
	global $dsql,$envs;
	print_r($envs);exit;
	//把属性转为变量，如果不想进行此步骤，也可以直接从 $ctag->CAttribute->Items 获得，这样也可以支持中文名
	$attlist="row|8";
	FillAttsDefault($ctag->CAttribute->Items,$attlist);
	extract($ctag->CAttribute->Items, EXTR_SKIP);
	$innertext = trim($ctag->GetInnerText());
	$revalue = '';
	if($innertext=='') $innertext = GetSysTemplets("part_likepage.htm");

	if(!isset($envs['likeid'])) $envs['likeid'] = 'all';
	echo "Select aid,title,filename From `#@__sgpage` where likeid like '{$envs['likeid']}' limit 0,$row";exit;
	$dsql->SetQuery("Select aid,title,filename From `#@__sgpage` where likeid like '{$envs['likeid']}' limit 0,$row");
	$dsql->Execute();
	$ctp = new DedeTagParse();
	$ctp->SetNameSpace('field','[',']');
	$ctp->LoadSource($innerText);
	while($row = $dsql->GetArray())
	{
		$row['url'] = $GLOBALS['cfg_cmsurl'].'/'.$row['filename'];
		foreach($ctp->CTags as $tagid=>$ctag){
			if(!empty($row[$ctag->GetName()])) $ctp->Assign($tagid,$row[$ctag->GetName()]);
		}
		$revalue .= $ctp->GetResult();
	}
	return $revalue;
}
?>