Copy CodeThe code is as follows:
/* Get Picture News list */
function Getpicnews ($number =5) {
Require_once ' include/content_class.php ';
$Content =new Content ();
$sql = ' Select ContentID as Id,title,pic,typeid from ' cms_content ' where pic<> ', ORDER by input_time Desc ';
$rows = $Content->getrowsbysql ($sql, $number);
$dom =new DOMDocument (' 1.0 ', ' GBK ');
$root = $dom->createelement (' Slider ');
$dom->appendchild ($root);
foreach ($rows as $val) {
$item = $dom->createelement (' item ');
$root->appendchild ($item);
$title = $dom->createattribute (' title ');
$title _text= $dom->createtextnode ($val [' title ']);
$title->appendchild ($title _text);
$item->appendchild ($title);
$href = $dom->createattribute (' href ');
$href _text= $dom->createtextnode (' show.php?newsid= '. $val [' id ']. ' &classid= '. $val [' typeid ']);
$href->appendchild ($href _text);
$item->appendchild ($HREF);
$imageurl = $dom->createattribute (' ImageUrl ');
$imageurl _text= $dom->createtextnode ($val [' pic ']);
$imageurl->appendchild ($imageurl _text);
$item->appendchild ($imageurl);
}
return $dom->savexml ();
}
http://www.bkjia.com/PHPjc/321949.html www.bkjia.com true http://www.bkjia.com/PHPjc/321949.html techarticle Copy the code as follows:/* Get the Picture News list */function getpicnews ($number =5) {require_once ' include/content_class.php '; $Content =new Content (); $sql = ' Select ContentID as ...