01 /*获取图片新闻列表*/
02 function getPicNews($number=5){
03 require_once 'include/content_class.php';
04 $Content=new Content();
05 $sql='select contentid as id,title,pic,typeid from `cms_content` where pic<>"" order by input_time desc';
06 $rows=$Content->getRowsBySQL($sql,$number);
07 $dom=new DOMDocument('1.0','GBK');
08 $root=$dom->createElement('slider');
09 $dom->appendChild($root);
10 foreach($rows as $val){
11 $item=$dom->createElement('item');
12 $root->appendChild($item);
13
14 $title=$dom->createAttribute('title');
15 $title_text=$dom->createTextNode($val['title']);
16 $title->appendChild($title_text);
17 $item->appendChild($title);
18
19 $href=$dom->createAttribute('href');
20 $href_text=$dom->createTextNode('show.php?newsid='.$val['id'].'&classid='.$val['typeid']);
21 $href->appendChild($href_text);
22 $item->appendChild($href);
23
24 $imageurl=$dom->createAttribute('imageurl');
25 $imageurl_text=$dom->createTextNode($val['pic']);
26 $imageurl->appendChild($imageurl_text);
27 $item->appendChild($imageurl);
28 }
29 return $dom->saveXML();
30 }