php - main(): and SimpleXMLElement::__toString(): Node no longer exists and -
i have php code geting xml feed , making html bootstap
<?php $x = 0; // how many feeds displayed if (!$_get) { $numfeeds = 13; } else { $numfeeds = $_get["numfeeds"]; } // feed information $html = ""; $url = " // url xml feed \\ "; $xml = simplexml_load_file($url); ($i = $x; $i < $numfeeds; $i++) { $portitem = "<div class='col-md-4 portfolio-item'>"; if ($x <= 3) echo $portitem; $image = $xml->channel->item[$i]->children('media', true)->content->attributes(); if (empty($image)) echo 'images/banana.jpg'; $title = $xml->channel->item[$i]->title; $link = $xml->channel->item[$i]->link; $pubdate = $xml->channel->item[$i]->pubdate; $author = $xml->channel->item[$i]->author; $description = $xml->channel->item[$i]->description; if (!$x++) echo $portitem; if ($x % 4 == 0) echo $portitem; $html .= html_entity_decode(" <br> $portitem <div> <p> <p>$pubdate, $author</p> <a href='$link'><h2>$title</h2></a></div> <br> <a href='$link'> <img class='img-responsive' src='$image' alt=''> </a> <p>$description</p> </p> </div> </div> <br>"); $x++; if ($x % 4 == 0) echo '</div>'; } echo print_r($html); ?>
everything seems working, getting te feed in format giving me theese 2 errors:
- main(): node no longer exists in rss.php on line 25
- simplexmlelement::__tostring(): node no longer exists in rss.php on line 47
how can deal them? there quick fix?
Comments
Post a Comment