new rss channel
This commit is contained in:
@@ -27,6 +27,17 @@ $posts = get_posts( array(
|
||||
'suppress_filters' => true, // подавление работы фильтров изменения SQL запроса
|
||||
));
|
||||
|
||||
|
||||
// Яндекс Новости
|
||||
create_rss_file($posts, 'views/rss/yanews.php', '/vhosts/beta/rss/yanews.xml');
|
||||
|
||||
// Общая лента
|
||||
create_rss_file($posts, 'views/rss/yanews.php', '/vhosts/beta/rss/news.xml');
|
||||
|
||||
|
||||
|
||||
exit;
|
||||
|
||||
if( $posts ){
|
||||
|
||||
|
||||
@@ -44,6 +55,30 @@ if( $posts ){
|
||||
|
||||
}
|
||||
|
||||
|
||||
function create_rss_file($posts, $temp, $file){
|
||||
|
||||
if( $posts ){
|
||||
|
||||
|
||||
ob_start();
|
||||
include($temp);
|
||||
$result = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
$result = trim($result);
|
||||
|
||||
if ($result !== ''){
|
||||
file_put_contents($file, trim($result));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user