TC_uk Posted August 18, 2007 Share Posted August 18, 2007 Hello. I've just started work on my first website design in 10 years! To say that I'm new to PHP would be an exaggeration... I plan to have a private web page for tech image reference, so when I saw a magazine article showing how to incorporate a Flickr gallery on to a site, using php and "phpFlickr", I thought, yeah, let's give it a try. Unfortunately (for me) all the PHP appears on a printed page, and I've had to recreate it by sight, and without a clue what it ought to look like and then why it's not working. As this uses Flickr.com (which needs an account) along with downloaded files from phpFlickr (https://sourceforge.net/project/showfiles.php?group_id=139987), I don't really expect anybody can do anymore than tell me what might be wrong with the following... What happens is that I get a parsing error on the require_once line. However, I've successfully run an alternate class from this self-same line (which at least proves that the require_once directory call is working), so I suspect that the problem is somewhere else...[i just don't know how to take this to pieces to see what's wrong...] If anybody would be kind enough to check the parsing/syntax for the attached and let me know what might be wrong, that would be truly great. Tim [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/65598-newb-can-anybody-tell-me-whats-wrong-with-this-flickr-php/ Share on other sites More sharing options...
Hypnos Posted August 18, 2007 Share Posted August 18, 2007 What's the full error? Quote Link to comment https://forums.phpfreaks.com/topic/65598-newb-can-anybody-tell-me-whats-wrong-with-this-flickr-php/#findComment-327540 Share on other sites More sharing options...
Hypnos Posted August 18, 2007 Share Posted August 18, 2007 I opened up the file, and there are line numbers. Looks like someone copied and pasted something more than they should have. Quote Link to comment https://forums.phpfreaks.com/topic/65598-newb-can-anybody-tell-me-whats-wrong-with-this-flickr-php/#findComment-327541 Share on other sites More sharing options...
TC_uk Posted August 18, 2007 Author Share Posted August 18, 2007 What's the full error? My browser returns... Parse error: syntax error, unexpected T_REQUIRE_ONCE in /home/blah/public_html/pictures.php on line 12 Okay...Thanks for your speed...I'll strip out the line numbers and re-post...10 minutes... Quote Link to comment https://forums.phpfreaks.com/topic/65598-newb-can-anybody-tell-me-whats-wrong-with-this-flickr-php/#findComment-327542 Share on other sites More sharing options...
Hypnos Posted August 18, 2007 Share Posted August 18, 2007 Hopefully you read this before you try to do it by hand. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <title>PHP Flickr Viewer</title> </head> <body> <?php require_once("phpFlickr/phpFlickr.php"); $flickr = new phpFlickr("long flickr api number"); $username="my_Flickr_username_w_underscores_-_case_sensitive?"; $open=$_GET["o"]; $page=$_GET["p"]; $viewpage=$_GET["v"]; if($open=="") { $page="1"; $viewpage="1"; } $width=10 $user = $flickr->people_findByUsername($username); if($user['id']==NULL){ echo "<div class=\"thumbnails\">\n"; echo "invalid username, or the Flickr API is down"; echo "</div>\n"; } $pics = $flickr->people_getPublicPhotos($user['id'], NULL, $width, $viewpage); $baseurl = $flickr->urls_getUserPhotos($user['id']); if($open=="") { $first=(current($pics['photo'])); $open=$first[id]; } echo "<div class=\"bigpic\">\n"; foreach ($pics['photo'] as $workingpic) { if($workingpic[id]==$open) { $workingurl = $flickr->buildPhotoURL($workingpic, "Medium"); $workingtitle = $workingpic[title]; echo "<h1>". $workingtitle ."</h1>\n"; echo "<a href=\"" . $baseurl . $open . "\">"; echo "<img alt=\"" . $workingtitle . "\"src=\"" . $workingurl . "\"/></a>\n"; } } echo "<p>Click on the image to open it's Flickr.com page</p>\n"; echo "</div>\n"; reset($pics); $pics = $flickr->people_getPublicPhotos($user['id'], NULL, $width, $page); echo "<div class=\"thumbnails\">\n"; echo "<p>Photostream pictures - click to open:</p>\n"; if($page!="1") { //display back link $linkp=($page-1); echo "<a href=\"./pictures.php?o=" . $open . "&p=" . $linkp . "&v=" . $viewpage . "\">back</a>\n"; } foreach ($pics['photo'] as $workingpic) { $workingurl = $flickr->buildPhotoURL($workingpic, "Square"); $workingtitle = $workingpic[title]; $workinglink = "./pictures.php?o=" . $workingpic[id] . "&p=" . $page . "&v=" . $page; echo "<a href=\"" . $workinglink . "\">"; echo "<img alt=\"" . $workingtitle . "\"src=\"" . $workingurl . "\"/></a>\n"; } $linkp=($page+1); if($linkp<=$pics['pages']) { echo "<a href=\"./pictures.php?o=" . $open . "&p=" . $linkp . "&v=" . $viewpage . "\">next</a>\n"; } ?> </div> </body> </html> Macros > making multiple changes by hand. Quote Link to comment https://forums.phpfreaks.com/topic/65598-newb-can-anybody-tell-me-whats-wrong-with-this-flickr-php/#findComment-327544 Share on other sites More sharing options...
TC_uk Posted August 18, 2007 Author Share Posted August 18, 2007 Hopefully you read this before you try to do it by hand. Actually I just launched the app I use and clicked 'remove' numbers. Is your code, my code without the numbers? TC [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/65598-newb-can-anybody-tell-me-whats-wrong-with-this-flickr-php/#findComment-327549 Share on other sites More sharing options...
Hypnos Posted August 18, 2007 Share Posted August 18, 2007 Yes. Quote Link to comment https://forums.phpfreaks.com/topic/65598-newb-can-anybody-tell-me-whats-wrong-with-this-flickr-php/#findComment-327556 Share on other sites More sharing options...
TC_uk Posted August 18, 2007 Author Share Posted August 18, 2007 The 10 minute hiatus was so I could check the text I'd already uploaded to the server, to see whether the line numbers were there as well - not necessarily - but actually, yes; they were! So I've stripped the numbers out and now the error is as follows: Parse error: syntax error, unexpected T_VARIABLE in /home/blah/public_html/pictures.php on line 25 ...Which is this: $user = $flickr->people_findByUsername($username); Quote Link to comment https://forums.phpfreaks.com/topic/65598-newb-can-anybody-tell-me-whats-wrong-with-this-flickr-php/#findComment-327561 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.