src/rss/Crss.php
private function createRSS()
    {
        $file = fopen($this->rssFile, "w+");

        $stmt = $this->db->prepare('SELECT * FROM ' . $this->table . ' ORDER BY CREATED DESC LIMIT ?');
        $stmt->execute([$this->newsCount]);
        $res = $stmt->fetchAll();

        $xmlVersion = '<?xml version="1.0" encoding="UTF-8" ?>';

        $startString = <<<EOD
{$xmlVersion}
<rss version="2.0">
<channel>
    <title>{$this->feedDescription['title']}</title>
    <link>{$this->feedDescription['link']}</link>
    <description>{$this->feedDescription['description']}</description>
EOD;
        fwrite($file, $startString);

        foreach ($res as $post) {
            $date = date("D, d M y H:i:s O", strtotime($post->CREATED));
            $string = <<<EOD

    <item>
        <title>{$post->TITLE}</title>
        <link>{$post->LINK}</link>
        <description>{$post->DESCRIPTION}</description>
        <pubDate>{$date}</pubDate>
    </item>
EOD;
            fwrite($file, $string);
        }

        fwrite($file, '
</channel>
</rss>');
    }
private function createRSS()
    {
        $file = fopen($this->rssFile, "w+");

        $stmt = $this->db->prepare('SELECT * FROM ' . $this->table . ' ORDER BY CREATED DESC LIMIT ?');
        $stmt->execute([$this->newsCount]);
        $res = $stmt->fetchAll();

        $xmlVersion = '<?xml version="1.0" encoding="UTF-8" ?>';

        $startString = <<<EOD
{$xmlVersion}
<rss version="2.0">
<channel>
    <title>{$this->feedDescription['title']}</title>
    <link>{$this->feedDescription['link']}</link>
    <description>{$this->feedDescription['description']}</description>
EOD;
        fwrite($file, $startString);

        foreach ($res as $post) {
            $date = date("D, d M y H:i:s O", strtotime($post->CREATED));
            $string = <<<EOD

    <item>
        <title>{$post->TITLE}</title>
        <link>{$post->LINK}</link>
        <description>{$post->DESCRIPTION}</description>
        <pubDate>{$date}</pubDate>
    </item>
EOD;
            fwrite($file, $string);
        }

        fwrite($file, '
</channel>
</rss>');
    }
private function createRSS ( ) { $ file = fopen ( $ this -> rssFile , "w+" ) ; $ stmt = $ this -> db -> prepare ( 'SELECT * FROM ' . $ this -> table . ' ORDER BY CREATED DESC LIMIT ?' ) ; $ stmt -> execute ( [ $ this -> newsCount ] ) ; $ res = $ stmt -> fetchAll ( ) ; $ xmlVersion = '<?xml version="1.0" encoding="UTF-8" ?>' ; $ startString =  <<<EOD
{$xmlVersion}
<rss version="2.0">
<channel>
    <title>{$this->feedDescription['title']}</title>
    <link>{$this->feedDescription['link']}</link>
    <description>{$this->feedDescription['description']}</description>
EOD ; fwrite ( $ file , $ startString ) ; foreach ( $ res as $ post ) { $ date = date ( "D, d M y H:i:s O" , strtotime ( $ post -> CREATED ) ) ; $ string =  <<<EOD

    <item>
        <title>{$post->TITLE}</title>
        <link>{$post->LINK}</link>
        <description>{$post->DESCRIPTION}</description>
        <pubDate>{$date}</pubDate>
    </item>
EOD ; fwrite ( $ file , $ string ) ; } fwrite ( $ file , '
</channel>
</rss>' ) ; }
Creates a new RSS File with information from the database. Max amount of news is configured in the initiation.

@return void
Creates a new RSS File with information from the database . Max amount of news is configured in the initiation .