CModule::IncludeModule("blog");
$arOrder = Array("DATE_CREATE" => "DESC");
$arFilter = Array("BLOG_ID"=>'1');
$arSelectedFields = Array("ID", "BLOG_ID", "POST_ID", "AUTHOR_ID", "AUTHOR_NAME", "TITLE", "POST_TEXT", "DATE_CREATE");
$dbComment = CBlogComment::GetList($arOrder, $arFilter, array("POST_ID", "MAX"=>"ID"), array("nTopCount"=>10), $arSelectedFields);
$PostID = array();
while ($arComment = $dbComment->Fetch())
{
$PostID[] = $arComment["POST_ID"];
//tpk_print_r($arComment,$arComment["POST_ID"],'all');
$ID = $arComment["POST_ID"];
$arComment = CBlogComment::GetByID($ID);
if(is_array($arComment))
tpk_print_r($arComment,$arComment["POST_ID"],'all');
else
echo "Комментарий не найден.";
}
CModule::IncludeModule("iblock");
$arSelect = Array("ID","NAME","DATE_CREATE","PROPERTY_BLOG_POST_ID","PREVIEW_TEXT");
$arFilter = Array("IBLOCK_ID"=>"48", "PROPERTY_BLOG_POST_ID"=>$PostID);
$res = CIBlockElement::GetList(Array(), $arFilter, false, Array("nTopCount"=>10), $arSelect);
while($ob = $res->GetNextElement())
{
$arFields = $ob->GetFields();
tpk_print_r($arFields,$arFields["ID"],'all');
/*echo '<tr align="left"><td width="500"><a href="http://www.uchmet.ru/library/material/'.$arFields["ID"].'/" >'.$arFields["NAME"].'</a><div>'.$arFields["PREVIEW_TEXT"].'</div></td>'.
'<td>'.$arFields["DATE_CREATE"].'</td>'.
'<td><a href="http://www.uchmet.ru/library/material/'.$arFields["ID"].'/#'.$arFields["PROPERTY_BLOG_POST_ID_VALUE"].'" >'.$arComment["NUM_COMMENTS"].' '.$arUser["NAME"].' '.$arUser["SECOND_NAME"].'</a></td>'.
'<td><a href="http://www.uchmet.ru/people/user/'.$arUser["ID"].'/" >'.$arUser["LAST_LOGIN"].'</a></td></tr>';*/
}
//echo "</tbody></table><br />"; |