Jump to content
Fórum Script Brasil
  • 0

ordenar rss


rubensxxx4

Question

Bom dia.

Estou há dias tentando fazer funcionar o código abaixo mas pelo jeito parece que tanto faz como eu mude o array_multisort, a ordenação continua errada. Quero ordenar por data, sendo que a mais recente fique mais embaixo no relatório (link).

Me ajudem!!!

foreach($xml->channel->item as $item)
{ 
$data = array(); $tituloitem = array(); $titulocanal = array(); $itemx = array();
 $itemx[] = $xml->channel->item;
  $descricao[] = utf8_decode($item->category);
  $data[] =  date('d/m/Y', strtotime($item->pubDate));
  $titulocanal[] = utf8_decode($xml->channel->title);
  //$titulocanal[] = substr($titulocanal, 0, 10);
  $tituloitem[] = utf8_decode($item->title);
  //$tituloitem[] = substr($tituloitem, 0, 95);
  $linkfeed[] = $item->link;
  $linkfeed2[] = str_replace("http://", "", "$linkfeed");
  array_multisort($data, $tituloitem, $titulocanal, SORT_ASC, $itemx);
  ?>
 <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
 <?php
 for($x=0; $x < count($item); $x++){
        echo "
  <tr align=\"center\" style:\"padding-top:2px; height:80px\" height=\"20\" >
    <td width=\"10\" style:\"padding-top:2px; height:80px\"><div align=\"center\">&nbsp</div></td>
        <td width=\"80\" align=\"center\"><div align=\"center\"><a href=\"$item->link\" target=\"Feed\"> $data[$x] </a></div></td>
    <td width=\"640\"><div align=\"center\"><a href=\"frame4.php?linkfeed=$linkfeed2\" target=\"Feed\" alt=\"$tituloitem\" title=\"$tituloitem\">$tituloitem[$x]</a></div></td>
    
    
    <td ><div align=\"center\"><a href=\"$item->link\" target=\"Feed\" alt=\"$titulocanal\" title=\"$titulocanal\">$titulocanal[$x]</a></div></td>
  </tr>
  ";
  }
  ?>
</table> 
<?php
}
}  
?>

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...