//获取顶级栏目名
function GetTopTypename($id)
{
global $dsql;
$row = $dsql->GetOne("SELECT typename,topid FROM #@_ _arctype WHERE id= $id");
if ($row['topid'] == '0')
{
return $row['typename'];
}
else
{
$row1 = $dsql->GetOne("SELECT typename FROM #@_ _arctype WHERE id= $row[topid]");
return $row1['typename'];
}
}
//获取顶级栏目id
function GetTopTypeid($id)
{
global $dsql;
$row = $dsql->GetOne("SELECT typename,topid FROM #@_ _arctype WHERE id= $id");
if ($row['topid'] == '0')
return $id;
else
{
$row1 = $dsql->GetOne("SELECT topid FROM #@_ _arctype WHERE id= $row[topid]");
if ($row1['topid'] == '0')
return $row[topid];
$row2 = $dsql->GetOne("SELECT topid FROM #@_ _arctype WHERE id= $row1[topid]");
if ($row2['topid'] == '0')
return $row1[topid];
}
}
|