"; $root_element ="homepage"; $xml .= "<$root_element>"; error_reporting(0); require '../../include/asset.php'; require '../../include/Conn.php'; require '../../include/config.php'; $main_img_path="393x213"; //$thumb_img_path="155x81"; $thumb_img_path="150x81"; $xml.=""; $query="SELECT title,ID,pdate,udate FROM news WHERE (scroll=1 AND mStatus=1) OR (mCat=2235 AND mStatus=1) ORDER BY udate DESC LIMIT 15"; $result=mysql_query($query) or die(mysql_error()); while($row=mysql_fetch_assoc($result)){ //$row['smalltitle']=htmlentities($row['smalltitle']); //$row['title']=htmlentities($row['title']); //$row['sData']=htmlentities($row['sData']); $sdata=text_summarise($row['title'], 19); $xml .="
{$row['ID']} {$row['title']} ".date("H:i",strtotime($row['udate']))."
"; } $xml.="
"; $xml .= ""; $xml = simplexml_load_string($xml); // where $xml_string is the XML data you'd like to use (a well-formatted XML string). If retrieving from an external source, you can use file_get_contents to retrieve the data and populate this variable. $json = json_encode($xml,JSON_UNESCAPED_UNICODE); // convert the XML string to JSON $array = json_decode($json,TRUE); echo $json; mysql_close($conn); $fp = fopen($cachefile, 'w'); // save the contents of output buffer to the file fwrite($fp, ob_get_contents()); // close the file fclose($fp); // Send the output to the browser ob_end_flush(); ?>