Victor,
Пример экспорта RSS комментариев ИС (вносится в
настройки типовой или просто динамической страницы):
<?php
// Код информационной системы
$information_systems_id = 1;
$InformationSystem = new InformationSystem();
$aIsRow = $InformationSystem->GetInformationSystem($information_systems_id);
if ($aIsRow)
{
$site_id = $aIsRow['site_id'];
$site = new site();
$site_alias = $site->GetCurrentAlias($site_id);
$aComments = $InformationSystem->GetCommentInformationSystemItem(array(
'information_systems_id' => $information_systems_id,
'begin' => 0,
'count' => 10));
/* Получаем глобально-доступный объект структуры */
$structure = & singleton('structure');
$DateClass = new DateClass();
$RssWrite = new RssWrite();
$RssWrite_mas_header = array();
$RssWrite_mas_header['title'] = "Заголовок канала"; // Заголовок канала
$RssWrite_mas_header['link'] = "http://{$site_alias}"; // Ссылка на сайт
$RssWrite_mas_header['description'] = ''; // Краткое описание RSS-потока
$i = 0;
foreach ($aComments as $row)
{
/* Получаем данные об элементы */
$item_row = $InformationSystem->GetInformationSystemItem($row['information_items_id']);
/* Получаем данные об инфосистеме */
$infsys_row = $InformationSystem->GetInformationSystem($item_row['information_systems_id']);
$url = '/'.$structure->GetStructurePath($infsys_row['structure_id'], 0);
if ($item_row)
{
/* Путь к элементу */
$path = $url . $InformationSystem->GetPathItem($item_row['information_items_id'],'');
/* Группы */
$group_id = $item_row['information_groups_id'];
$group_path_html = '';
// Строим путь групп к элементу
while ($group_id != 0)
{
$group_array = $InformationSystem->GetInformationGroup($group_id);
$group_path = $InformationSystem->GetPathGroup($group_id, '');
$group_sub_path_html = $group_array['information_groups_name'];
if (!empty($group_path_html))
{
$group_path_html = $group_sub_path_html . ' - ' . $group_path_html;
}
else
{
$group_path_html = $group_sub_path_html;
}
$group_id = $group_array['information_groups_parent_id'];
}
// Временный массив для формирования заголовка
$aTmp = array();
if (!empty($row['comment_fio']))
{
$aTmp[] = $row['comment_fio'];
}
$aTmp[] = "отзыв об {$item_row['information_items_name']}";
if (!empty($group_path_html))
{
$aTmp[] = $group_path_html;
}
// Заголовок - тема комментария, формируем по схеме:
$RssWrite_mas_items[$i]['title'] = implode(" - ", $aTmp);
// Ссылка на страничку с группой новостей, к которой принадлежит комментарий
$RssWrite_mas_items[$i]['link'] = "http://{$site_alias}{$path}";
// Дата создания комментария
$RssWrite_mas_items[$i]['pubDate'] = $row['comment_date'];
// Описание - текст комментария
$RssWrite_mas_items[$i]['description'] = $row['comment_text'];
$i++;
}
}
echo $RssWrite->CreateRSS($RssWrite_mas_header,$RssWrite_mas_items);
}
exit();
?>