Incorporado en el método Kohana para ayudar con el desarrollo de un canal RSS

StackOverflow https://stackoverflow.com/questions/937921

  •  06-09-2019
  •  | 
  •  

Pregunta

He descubierto que hay un ayudante para ayudar en el análisis de los canales RSS en el marco Kohana.

¿Hay uno para ayudar a crear uno?

¿Fue útil?

Otros consejos

látigo hasta que con el método de la clase create() Feed en Kohana 3. Encontrará el código de la misma en lo siguiente:

  

sistema / classes / kohana / feed.php

Se deberá definen la información del canal y sus artículos de alimentación como un mínimo.

$info = array(
           'title' => 'Dark into the Narwhal',
           'pubDate' => date("D, d M Y H:i:s T"),
           'description' => 'Eating bacon, taking names and leaving fortunes',
           'link' => 'http://example.com/',
           'copyright' => 'The Narwhal Peon',
           'language' => 'en-us',
           'ttl' => '7200',
        );

$items = array(
           array(
               'title' => 'We journey with watermelon helmets',
               'link' => 'blog/journey-with-watermelon-helmets',
               'description' => 'Dawn breaks and the wind follows soon after. 
                                 We have found our supplies run low.',
           ),

            //-- and the other posts you want to include
         ); 

Luego enchufe que los datos en el método para generar el XML:

$xml = Feed::create($info, $items);

¿Qué le dará esto cuando echo hacia fuera o pasarlo a la vista correspondiente:

<?xml version="1.0" encoding="UTF-8"?>
 <rss version="2.0">
  <channel>
  <title>Dark into the Narwhal</title>
  <pubDate>Fri, 21 Dec 2012 13:32:42 EST</pubDate>
  <description>Eating bacon, taking names and leaving fortunes</description>
  <link>http://example.com/</link>
  <copyright>The Narwhal Peon</copyright>
  <language>en-us</language>
  <ttl>7200</ttl>
  <generator>KohanaPHP</generator>
  <item>
    <title>We journey with watermelon helmets</title>
    <link>http://example.com/blog/journey-with-watermelon-helmets</link>
    <description>Dawn breaks and the wind follows soon after. 
                 We have found our supplies run low.</description>
  </item>

  <!-- the other posts will be here -->

  </channel>
</rss>
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top