Ver Mensaje Individual
  #1 (permalink)  
Antiguo 30/08/2010, 14:21
fellows
 
Fecha de Ingreso: agosto-2010
Mensajes: 3
Antigüedad: 13 años, 8 meses
Puntos: 0
Problemas (iconv + strftime)

Buenas a todos,

Hace un rato que estoy intentando solventar el problema.. pero vamos, que no hay manera.. si alguien es amable de decirme donde me estoy equivocando me vendría de perlas.. >,<, aquí el código:

Código PHP:
<?php 
    
    
class RssReader 
        var 
$url
        var 
$data
        
        function 
RssReader ($url){ 
            
$this->url
            
$this->data implode (""file ($url)); 
        } 
        
        function 
get_items (){ 
            
preg_match_all ("/<item .*>.*<\/item>/xsmUi"$this->data$matches); 
            
$items = array (); 
            foreach (
$matches[0] as $match){ 
                
$items[] = new RssItem ($match); 
            } 
            return 
$items
        } 
    } 
    
    class 
RssItem 
        var 
$title$url$description$pubdate
        
        function 
RssItem ($xml){ 
            
$this->populate ($xml); 
        } 
        
        function 
populate ($xml){ 
            
preg_match ("/<title> (.*) <\/title>/xsmUi"$xml$matches); 
            
$this->title $matches[1]; 
            
preg_match ("/<link> (.*) <\/link>/xsmUi"$xml$matches); 
            
$this->url $matches[1]; 
            
preg_match ("/<pubDate> (.*) <\/pubDate>/xsmUi"$xml$matches); 
            
$this->pubdate $matches[1]; 
    } 
    
    function 
get_title (){ 
            return 
iconv('UTF-8''ISO-8859-1'$this->title);
        } 
    
        function 
get_url (){ 
            return 
$this->url
        } 
        
        function 
get_description (){ 
            return 
$this->description
        } 
        
        function 
get_pubdate (){
            return 
iconv('UTF-8''UTF-8'strftime('%d/%m/%Y'$this->pubdate));
        }
    } 

$rss = new RssReader ("http://forums.wowtemplars.es/es/index.php?app=core&module=global&section=rss&type=forums&id=2"); 
    
    foreach (
$rss->get_items () as $item){ 
        
printf ('<tr class="hilite"><td style="width: 30px;" align="center"><img class="postImg" src="http://www.wowtemplars.es/extra/imagenes/new-hp/icons/0.gif" /></td><td style="width: 350px;"><div class="hdl"><h3><a href="%s" target="_blank">%s</a></h3><span class="author">&nbsp;</span></div><span class="news-plusLink"><a href="%s" target="_blank"></a></span></td><td style="width: 77px;" align="center"><span class="date"><small>%s</small></span></td></tr>'
        
$item->get_url (), $item->get_title (), $item->get_url (), $item->get_pubdate ()); 
    }
?>
El error está en esta línea en concreto: "return iconv('UTF-8', 'UTF-8', strftime('%d/%m/%Y', $this->pubdate));" devuelve un Warning: strftime() expects parameter 2 to be long, string given in xxx on line 53, y la fecha no se muestra.

Saludos