RSS Feed Problems

#1
[eluser]Jings[/eluser]
Hey there,

i am new here. I am from Cologne/Germany, so my English is not the best Big Grin

I have two problems with my RSS Feed made with Codeigniter.

I used this Tutorial by Derek Allard (Really great Guy)
http://www.derekallard.com/blog/post/bui...e-igniter/

Now, what have i to type in for German Language. I tried
Code:
$data['page_language'] = 'de'; //and
$data['page_language'] = 'de-de'; // and
$data['page_language'] = 'ge'; //for german

Nothing works! =(

The second Problem is, that the RSS Feed doesnt show every Entry of my Database.

Model:
Code:
<?php
Class Post_model extends Model{

    function getPosts($limit = NULL){
        $this->db->where('Active', 1);
        $this->db->limit(10);
        return $this->db->get('angebote');
    }

}

There are only 5 Entrys in Database so why does the RSS feed only show 3 of them?

Thanks in Advance,
Jings

#2
[eluser]InsiteFX[/eluser]
You need to create your own language file under application/language/

Say a directory of application/language/de

You can read it here in the CodeIgniter User Guide.

Language Class

Code:
Class Post_model extends Model{

    function getPosts($limit = NULL){
        $this->db->where('Active', 1);
        $this->db->limit(10);
        $query = $this->db->get('angebote');
    }
    
    return $query->row_array();
}

InsiteFX

#3
[eluser]Jings[/eluser]
Okay, Language Class is done Smile

But your Code doesn´t work... It throws an Exception.

Quote:Parse error: syntax error, unexpected T_RETURN, expecting T_FUNCTION in C:\xampp\htdocs\kimmo_new\system\application\models\post_model.php on line 10

Model:
Code:
<?php
Class Post_model extends Model{

    function getPosts(){
        $this->db->where('Active', 1);
        return $this->db->get('angebote');
    }
    
}

Controller:
Code:
<?php
class Feed extends Controller {  
  
    function Feed()  
    {  
        parent::Controller();
        $this->load->helper('xml');
        $this->load->helper('text');
        $this->load->model('post_model', 'posts');
    }  
    
    function index(){
        $data['feedname'] = "Krumbein-Immobilien RSS Feed";
        $data['encoding'] = "utf-8";
        $data['feed_url'] = base_url()."feed";
        $data['page_description'] = 'Alle Angebote auf einen Blick';
        $data['page_language'] = 'de-de';
        $data['creator_email'] = '[email protected]';
        $data['posts'] = $this->posts->getPosts();
        header("Content-Type: application/rss+xml");
        
        $this->load->view('rss', $data);
    }
}

View:
Code:
<?php
echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
    xmlns:admin="http://webns.net/mvcb/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:content="http://purl.org/rss/1.0/modules/content/">

    <channel>
    
    &lt;title&gt;&lt;?php echo $feedname; ?&gt;&lt;/title&gt;

    &lt;link&gt;&lt;?php echo $feed_url; ?&gt;&lt;/link&gt;
    <description>&lt;?php echo $page_description; ?&gt;</description>
    <dc:language>&lt;?php echo $page_language; ?&gt;</dc:language>
    <dc:creator>&lt;?php echo $creator_email; ?&gt;</dc:creator>
    
    <dc:rights>Copyright &lt;?php echo gmdate("Y", time()); ?&gt;</dc:rights>

    &lt;?php foreach($posts->result() as $entry): ?&gt;
    
        <item>

          &lt;title&gt;&lt;?php echo xml_convert($entry->Titel); ?&gt;&lt;/title&gt;
          &lt;link&gt;&lt;?php echo $entry->Immoscout ?&gt;&lt;/link&gt;

            <description>
                &lt;![CDATA[
                    &lt;?php echo $entry->Beschreibung . "<br />" . $entry->qm . "<br />" . $entry->Preis . "<br />" . $entry->Adresse?&gt;
                ]]>
            </description>
        </item>

        
    &lt;?php endforeach; ?&gt;
    
    </channel></rss>


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.