genera_xml.php
Código PHP:
<?
header("Content-type: text/xml");
echo '<?xml version="1.0" encoding="ISO-8859-1"'.'?'.'>';
include("db_config.php");
// fechaf = year(now)&"/"&month(now)&"/"&day(now) & " " & formatdatetime(now,4)' & ":00" BUILD IN ASP
$fecha= date("Y/j/d g:i:s").":00";
$sel="SELECT * FROM Notas WHERE NStatus = 1 AND NTipo = 1 AND NHome = 1 AND NFecha <= '".$fecha."' ORDER BY NFecha DESC LIMIT 5";
$rs=$c1->Execute($sel);
$max = $rs->RecordCount();
$i=0;
echo '<noticias>';
while(!$rs->EOF && $i < $max){
$rs->Move($i);
echo '<item>';
echo '<fecha>'.$rs->fields("NFecha").'</fecha>';
echo '<titulo>'.$rs->fields("NTitulo").'</titulo>';
echo '<nota>'.$rs->fields("NCuerpo").'</nota>';
echo '</item>';
$i++;
}
echo '</noticias>';
?>
Código:
espero que me puedan ayudar....<?xml version="1.0" encoding="utf-8"?> <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#FFFFFF, #FFFCFC]" width="1168" height="670"> <mx:Script> <![CDATA[ import mx.controls.Alert; import mx.collections.ArrayCollection; import mx.rpc.events.ResultEvent; private function initApp():void { NotasPHP.send(); } [Bindable] private var NoticiasData:ArrayCollection=new ArrayCollection(); [Bindable] private var UltimasData:ArrayCollection=new ArrayCollection(); private function noticiasInHandler(event:ResultEvent):void { var notRaw:ArrayCollection = event.result.noticias.item; for (var i:int=0;i < notRaw.length;i++) { var tempNot:Object = notRaw.getItemAt(i); NoticiasData.addItem(tempNot); } for (var j:int=0;i< 2;i++) { var temUlt:Object = notRaw.getItemAt(i); UltimasData.addItem(temUlt); } } ]]> </mx:Script> <mx:HTTPService id="NotasPHP" url="http://localhost/agencia/xml/genera_xml.php" result="noticiasInHandler(event)" showBusyCursor="true"/> <mx:Canvas x="0" y="169" width="200" height="499" backgroundColor="#FFFFFF" backgroundAlpha="0.7" horizontalScrollPolicy="off" verticalScrollPolicy="off"> <mx:LinkButton x="54" y="30" label="Inicio" width="69" height="29"/> </mx:Canvas> <mx:Canvas width="966" height="499" x="200" y="169" id="principal"> <mx:Canvas x="19" y="10" width="906" height="93" backgroundColor="#E7E6E6"> <mx:Label x="0" y="0" text="Ultima Noticias" id="last_new" fontSize="12" width="906" kerning="true"/> <mx:Repeater id="lastNews" dataProvider="{UltimasData}"> <mx:LinkButton id="LstNew" fontStyle="normal" fontFamily="times" color="#CFD3F9" label="{lastNews.currentItem.titulo}" y="29" width="290" height="64"/> </mx:Repeater> </mx:Canvas> </mx:Canvas> <mx:Style source="style.css"/> <mx:ApplicationControlBar x="0" y="0" width="{this.width}" height="170" id="AppBar" autoLayout="true"> <mx:Image source="img/adminsup.png" width="{this.width}" height="145" scaleContent="true"/> </mx:ApplicationControlBar> </mx:WindowedApplication>
saludos