Foros del Web » Programando para Internet » PHP »

Que pasa aqui

Estas en el tema de Que pasa aqui en el foro de PHP en Foros del Web. hola todos, tengo este problemita q por mas q he buscado ya no se q pasa, espero me ayuden estoy usando este script para agregar ...
  #1 (permalink)  
Antiguo 30/04/2010, 08:11
 
Fecha de Ingreso: diciembre-2008
Mensajes: 83
Antigüedad: 15 años, 4 meses
Puntos: 0
Pregunta Que pasa aqui

hola todos, tengo este problemita q por mas q he buscado ya no se q pasa,
espero me ayuden

estoy usando este script para agregar rss a mi sitio

rss.php
Código PHP:
set_time_limit(0);

$RSS_Content = array();

function 
RSS_Tags($item$type)
{
        
$y = array();
        
$tnl $item->getElementsByTagName("title");
        
$tnl $tnl->item(0);
        
$title $tnl->firstChild->textContent;

        
$tnl $item->getElementsByTagName("link");
        
$tnl $tnl->item(0);
        
$link $tnl->firstChild->textContent;

        
$tnl $item->getElementsByTagName("description");
        
$tnl $tnl->item(0);
        
$description $tnl->firstChild->textContent;

        
$y["title"] = $title;
        
$y["link"] = $link;
        
$y["description"] = $description;
        
$y["type"] = $type;
        
        return 
$y;
}


function 
RSS_Channel($channel)
{
    global 
$RSS_Content;

    
$items $channel->getElementsByTagName("item");
    
    
// Processing channel
    
    
$y RSS_Tags($channel0);        // get description of channel, type 0
    
array_push($RSS_Content$y);
    
    
// Processing articles
    
    
foreach($items as $item)
    {
        
$y RSS_Tags($item1);    // get description of article, type 1
        
array_push($RSS_Content$y);
    }
}

function 
RSS_Retrieve($url)
{
    global 
$RSS_Content;

    
$doc  = new DOMDocument();
    
$doc->load($url);

    
$channels $doc->getElementsByTagName("channel");
    
    
$RSS_Content = array();
    
    foreach(
$channels as $channel)
    {
         
RSS_Channel($channel);
    }
    
}


function 
RSS_RetrieveLinks($url)
{
    global 
$RSS_Content;

    
$doc  = new DOMDocument();
    
$doc->load($url);

    
$channels $doc->getElementsByTagName("channel");
    
    
$RSS_Content = array();
    
    foreach(
$channels as $channel)
    {
        
$items $channel->getElementsByTagName("item");
        foreach(
$items as $item)
        {
            
$y RSS_Tags($item1);    // get description of article, type 1
            
array_push($RSS_Content$y);
        }
         
    }

}


function 
RSS_Links($url$size 15)
{
    global 
$RSS_Content;

    
$page "<ul>";

    
RSS_RetrieveLinks($url);
    if(
$size 0)
        
$recents array_slice($RSS_Content0$size 1);

    foreach(
$recents as $article)
    {
        
$type $article["type"];
        if(
$type == 0) continue;
        
$title $article["title"];
        
$link $article["link"];
        
$page .= "<li><a href=\"$link\">$title</a></li>\n";            
    }

    
$page .="</ul>\n";

    return 
$page;
    
}



function 
RSS_Display($url$size 15$site 0)
{
    global 
$RSS_Content;

    
$opened false;
    
$page "";
    
$site = (intval($site) == 0) ? 0;

    
RSS_Retrieve($url);
    if(
$size 0)
        
$recents array_slice($RSS_Content$site$size $site);

    foreach(
$recents as $article)
    {
        
$type $article["type"];
        if(
$type == 0)
        {
            if(
$opened == true)
            {
                
$page .="</ul>\n";
                
$opened false;
            }
            
$page .="<b>";
        }
        else
        {
            if(
$opened == false
            {
                
$page .= "<ul>\n";
                
$opened true;
            }
        }
        
$title $article["title"];
        
$link $article["link"];
        
$description $article["description"];
        
$page .= "<li><a href=\"$link\">$title</a>";
        if(
$description != false)
        {
            
$page .= "<br>$description";
        }
        
$page .= "</li>\n";            
        
        if(
$type==0)
        {
            
$page .="</b><br />";
        }

    }

    if(
$opened == true)
    {    
        
$page .="</ul>\n";
    }
    return 
$page."\n";
    
//return $article;
    

luego algo como asi

index.php
Código PHP:
include 'rsslib.php';

$url 'http://www.cubadebate.cu/categoria/reflexiones-fidel/feed/';
echo 
RSS_Display($url); 
lee bien el rss pero lo primero q me mustra esto

! ) Notice: Trying to get property of non-object in D:\wamp\www\workspace\rsslib.php on line 33
Call Stack
# Time Memory Function Location
1 0.0009 355944 {main}( ) ..\index.php:0
2 0.0018 399744 RSS_Display( ) ..\index.php:18
3 0.0018 399888 RSS_Retrieve( ) ..\rsslib.php:147
4 28.2288 402968 RSS_Channel( ) ..\rsslib.php:81
5 28.2289 403224 RSS_Tags( ) ..\rsslib.php:56

y debajo de esto las noticias, y esto me molesta pq no puedo mostrarlo asi en mi web

puede alguien ayudarme
  #2 (permalink)  
Antiguo 03/05/2010, 22:12
Avatar de metacortex
Viejo demente
 
Fecha de Ingreso: junio-2004
Ubicación: Caracas - Venezuela
Mensajes: 9.027
Antigüedad: 19 años, 10 meses
Puntos: 832
Respuesta: Que pasa aqui

Camarada, revisa este tópico de abimaelrc:

http://www.forosdelweb.com/f18/aport...ml-dom-792348/

Etiquetas: Ninguno
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 17:08.