RSS 피드 개발에 도움이되는 내장 Kohana 방법
문제
Kohana 프레임 워크에 대한 RSS 피드의 구문 분석을 돕기위한 도우미가 있음을 발견했습니다.
하나를 만드는 데 도움이되는 것이 있습니까?
다른 팁
그것을 채찍으로 채워 create()
방법의 방법 Feed
Kohana의 클래스 3. 다음과 같은 코드를 찾을 수 있습니다.
시스템/클래스/kohana/feed.php
당신은 필요합니다 채널 정보 및 피드 항목을 최소로 정의하십시오..
$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
);
그런 다음 해당 데이터를 메소드에 연결하여 XML을 생성합니다.
$xml = Feed::create($info, $items);
당신이 이것을 줄 것입니다 echo
그것은 관련 견해로 전달하거나 전달합니다.
<?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>
제휴하지 않습니다 StackOverflow