file = $file; $this->title = $title; $this->link = $link; $this->description = $description; } public function refresh() { if ($this->write() === true) {return true;} } protected function write() { $fp = fopen($this->file, 'w+'); $xml_flow = ''. "\n"; $xml_flow .= ''. "\n"; $xml_flow .= ''. "\n"; $xml_flow .= ''.$this->title.''. "\n"; $xml_flow .= ''.$this->link.''. "\n"; $xml_flow .= ''.$this->description.''. "\n"; fputs ($fp, $xml_flow); $articles = new Articles(); $items = $articles->fetchAll(null,array('date desc', 'time desc'),10,0); $items = $items->toArray(); foreach ($items as $item) { $xml_item = ''. "\n"; $xml_item .= ''. $item['title']. ''. "\n"; $xml_item .= ''.ROOT_URL.'/article/detail/?perm='.$item['perm']. ''. "\n"; $xml_item .= ''. "\n"; fputs ($fp, $xml_item); } $xml_flow = ''. "\n"; $xml_flow .= ''; fputs ($fp, $xml_flow); fclose ($fp); return true; } } ?>