Пример #1
0
    if (empty($noticia["STR_LINK"])) {
        $publicacaoid = $noticia["INT_PUBLICACAO_ID"];
        $siteid = $noticia["INT_SITE_ID"];
        $sessaoid = $noticia["INT_SESSAO_ID"];
        if ($siteid == 1) {
            $sitenome = "tj";
        } elseif ($siteid == 2) {
            $sitenome = "cgj";
        } elseif ($siteid == 3) {
            $sitenome = "esmam";
        }
        $link = "http://www.tjma.jus.br/{$sitenome}/visualiza/sessao/{$sessaoid}/publicacao/{$publicacaoid}";
    }
    $item->link = $link;
    $item->guid = $link;
    $data = $noticia["DTA_ATUALIZACAO"];
    $dia = substr($data, 0, 2);
    $mes = substr($data, 3, 2);
    $ano = substr($data, 6, 2);
    $ano = "20" . $ano;
    $data = $ano . "-" . $mes . "-" . $dia;
    $data = new DateTime($data);
    $strData = date_format($data, "D, j M Y H:i:s");
    $item->pubDate = $strData;
    $rss_channel->items[] = $item;
}
$rss_feed = new rssGenerator_rss();
$rss_feed->encoding = 'UTF-8';
$rss_feed->version = '2.0';
header('Content-Type: text/xml');
echo $rss_feed->createFeed($rss_channel);
Пример #2
0
 function createFeedCode($title, $data_arr, $url = FALSE)
 {
     require_once _base_ . "/addons/feeds/write/rss_generator.inc.php";
     if ($url === FALSE) {
         $url = $GLOBALS[$this->platform]["url"];
     }
     $feed = new rssGenerator_channel();
     $feed->title = $title;
     $feed->link = $url;
     $feed->description = " ";
     //		$feed->language = 'en-us';
     $feed->generator = "FormaLms " . $GLOBALS["framework"]["core_version"];
     //		$feed->managingEditor = 'editor@mysite.com';
     //		$feed->webMaster='webmaster@mysite.com';
     $i = 0;
     reset($data_arr);
     while (($data = each($data_arr)) && $i < $this->getMaxFeedItems()) {
         $item = new rssGenerator_item();
         $item->title = '<![CDATA[' . $data["value"]["title"] . ']]>';
         $item->description = '<![CDATA[' . $data["value"]["description"] . ']]>';
         $item->link = $data["value"]["url"];
         $item->pubDate = $data["value"]["date"];
         $feed->items[] = $item;
     }
     $feed_code = new rssGenerator_rss();
     $feed_code->encoding = 'UTF-8';
     $feed_code->version = '2.0';
     $code = $feed_code->createFeed($feed);
     // $code=utf8_encode($code);
     return $code;
 }