Making RSS sources

dom = new DOMDocument('1.0','utf-8'); $this->dom->load($this ->template);} //Encapsulate the createChannel method to create the only and necessary channel node public function createChannel() {$channel = $this->dom->createElement('channel'); $channel->appendChild( $this->createEle('title',$this->title)); $channel->appendChild($this->createEle('link',$this->link)); $channel->appendChild($this ->createEle('description',$this->description)); $this->dom->appendChild($channel);} //Call createItem to generate all item nodes public function display() {$this ->createChannel(); header('content-type:text/xml'); echo $this->dom->savexml();} //Encapsulate a method to create item protected function crea teItem($arr) {$item = $this->dom->createElement('item'); foreach ($$arr as $k => $v) {$item->appendChild($this->createEle($ k,$v));} return $item;} //Encapsulate a method and directly create a node such as some text protected function createEle($name,$value) {$ele = $this ->dom->createElement($name); $text = $this->dom->createTextNode($value); $ele->appendChild($text); return $ele; })$feed = new feed() ;$feed->display();?>

The running results are as follows:

< /p>

The feed.xml that will be used is as follows:

< ?xml version="1.0" encoding="utf-8"?>

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 1829 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.