в файле добавьте функию
function GetAllNewsUrl()
{
$gCms = cmsms();
$results = $res = $params = array();
$detailpage = 23;
$db = $this->GetDb();
$query = "SELECT news_title,news_url,news_id,modified_date FROM " .
cms_db_prefix() . "module_news WHERE status = 'published'";
$result = $db->Execute($query);
while ($result && !$result->EOF)
{
$aliased_title = munge_string_to_url($result->fields['news_title']);
$prettyurl = 'news/' . $result->fields['news_id'] . '/' . $detailpage . "/$aliased_title" .
$detailtemplate;
$res['prettyurl'] = $prettyurl;
$res['id'] = $result->fields['news_id'];
$res['time'] = $result->fields['modified_date'];
$parms = array();
$parms['articleid'] = $result->fields['news_id'];
$res['url'] = $this->CreateLink('cntnt01', 'detail', $detailpage, '', $parms, '', true, false,
'', true, $prettyurl);
$results[] = $res;
$result->MoveNext();
}
return $results;
}
и внутри функции
function GenerateSiteMap(&$params)
{
после
$output[] = $obj;
}
добавьте цикл
$news = $this->GetAllNewsUrl();
foreach ($news as $onecontent)
{
$obj = new StdClass();
$priority = 0.7;
$obj->priority = number_format($priority, 1, '.', '');
$obj->encoded_url = cms_htmlentities($onecontent['url']);
$obj->cachable = false;
$obj->child_count = 0;
$obj->hierarchy = '';
$obj->date = trim($db->DbTimeStamp($onecontent['time']), "'");
$obj->url = $onecontent['url'];
$obj->id = $onecontent['id'];
$obj->type = 'news';
$obj->frequency = $this->GetPreference('change_frequency', 'auto');
if ($obj->frequency == 'auto')
{
$obj->frequency = 'hourly';
if ($mdate < $onedayago)
$obj->frequency = 'daily';
if ($mdate < $oneweekago)
$obj->frequency = 'weekly';
if ($mdate < $onemonthago)
$obj->frequency = 'monthly';
if ($mdate < $oneyearago)
$obj->frequency = 'yearly';
}
$output[] = $obj;
}
Комментарии
Оставить комментарий
Выполнение скриптов на стороне сервера PHP (LAMP) NodeJS (Backend)
Термины: Выполнение скриптов на стороне сервера PHP (LAMP) NodeJS (Backend)