foucquet Posted May 30, 2014 Share Posted May 30, 2014 (edited) I am trying to put an rss feed from my Flickr account into my website I have got thus far with my class:- <?php // Flickr Class class flickr { // Properties var $feed; //=================== // Construct Flickr function __construct($feed) { $this->feed = $feed; } //=================== // Parse Method function parse() { $rss = simplexml_load_file($this->feed); $photodisp = array(); foreach ($rss->channel->item as $item) { $link = (string) $item->link; // Link to this photo $title = (string) $item->title; // Title of this photo $media = $item->children('http://search.yahoo.com/mrss/'); $thumb = $media->thumbnail->attributes(); $url = (string) $thumb['url']; // URL of the thumbnail $width = (string) $thumb['width']; // Width of the thumbnail $height = (string) $thumb['height']; // Height of the thumbnail $photodisp[] = <<<________________EOD {$title} ________________EOD; } return $photodisp; } //=================== // Display Method function display($numrows=6,$head="Photos on Flickr") { $photodisp = $this->parse(); $i = 0; $thumbs = <<<____________EOD $head ____________EOD; while ( $i < $numrows ) { $thumbs .= $photodisp[$i]; $i++; } $trim = str_replace('http://api.flickr.com/services/feeds/photos_public.gne?id=', '',$this->feed); $user = str_replace('〈=en-us&format=rss_200','',$trim); $thumbs .= <<<____________EOD View All Photos on Flickr ____________EOD; return $thumbs; } //=================== } //End of Class ?> // <- Line 66 and it gives me "Parse error: syntax error, unexpected end of file in C:\wamp\www\image-a-nation\test4_class.php on line 66". I thought it might be an unclosed brace/bracket or something like that, but no amount of checking finds anything - would appreciate a fresh pair of eyes... Edited May 30, 2014 by foucquet Quote Link to comment https://forums.phpfreaks.com/topic/288875-unexpedted-end-of-file/ Share on other sites More sharing options...
Solution Ch0cu3r Posted May 30, 2014 Solution Share Posted May 30, 2014 The problem is to do with the closing heredoc delimiter ( ____________EOD; ) used on lines 34, 47 and 57. No characters (including spaces) should proceed the closing delimiter. The closing delimiter for a heredoc statement should start at the very first character of the next line. But there is no need for the use of heredoc in your situation, it is mainly used for large complex strings not for one liners. Lines 32 - 34 should be $photodisp[] = "$title"; Lines 45 - 47 should be $thumbs = "head"; Lines 55 - 57 should be $thumbs .= "View All Photos on Flickr"; Quote Link to comment https://forums.phpfreaks.com/topic/288875-unexpedted-end-of-file/#findComment-1481375 Share on other sites More sharing options...
foucquet Posted May 30, 2014 Author Share Posted May 30, 2014 Of course! What a dummy, Iknew a fresh pair of eyes would help - thanks. Quote Link to comment https://forums.phpfreaks.com/topic/288875-unexpedted-end-of-file/#findComment-1481380 Share on other sites More sharing options...
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.