noraft Posted April 18, 2011 Share Posted April 18, 2011 I'm trying to create a Facebook fangate, and I want an imagemap to come up to fans, but a static image to come up for non-fans. Here's the code. Someone please tell me what I'm doing wrong. I've tried it 3 different ways. (I searched Google and this forum before posting...nothing I found worked for me). While I've removed identifying information, I have tested and made sure the bitmapped image works properly (can call it through facebook on its own) as well as the regular image. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html lang="en" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <link rel="stylesheet" type="text/css" href="style.css" /> <style type="text/css"> body { width:520px; margin:0; padding:0; border:0; }</style> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> </head> <body> <? require 'facebook.php'; $app_id = "XXXXXXXXX"; $app_secret = "XXXXXXXXXXX"; $facebook = new Facebook(array( 'appId' => $app_id, 'secret' => $app_secret, 'cookie' => true )); $signed_request = $facebook->getSignedRequest(); if ($like_status) { ?> <div><img src="http://xxxxxx.com/facebook/FBnavbar.png" alt="" usemap="#FB Nav Bar" style="border-style: none" /></div> <div> <map id="FB Nav Bar" name="FB Nav Bar"> <area shape="rect" alt="About xxxxxx Social Media" coords="6,21,80,42" href="http://www.facebook.com/xxxxxxx?sk=info" title="About xxxxxx Social Media" /> <area shape="rect" alt="xxxxxx Blog" coords="222,24,276,38" href="http://www.facebook.com/xxxxxxxsk=app_?????" title="xxxxxx Blog" /> <area shape="rect" alt="xxxxxx Social Media" coords="297,23,391,39" href="" title="xxxxxx Social Media" /> <area shape="rect" alt="Contact xxxxxx Social Media" coords="409,23,508,39" href="../../../contact/" title="Contactxxxxxx Social Media" /> <area shape="rect" alt="Subscribe to our RSS feed" coords="443,1,459,14" href="http://feedburner.com/xxxxx" title="Subscribe to our RSS feed" /> <area shape="rect" alt="Share us on delicious" coords="463,0,478,18" href="http://www.delicious.com/share?new=1&hash=e16eda577a70c83c0dfa2c8c29e52d24&key=tnNrKLSea55V6Tkd2ze9ujDWVOs-&title=xxxxxxx%2xxxxp%20Reputation%20Management&url=http%3A%2F%2Fxxxxxxx%2F&jump=%2Furl%2Fe16eda577a70c83c0dfa2c8c29e52d24" title="Share us on delicious" /> <area shape="rect" alt="Add us on LinkedIn" coords="485,3,499,18" href="http://www.linkedin.com/company/xxxxxx" title="Add us on LinkedIn" /> <area shape="rect" alt="Follow our Director on Twitter" coords="503,1,519,17" href="http://www.twitter.com/xxxxxxx" title="Follow our Director on Twitter" /> <area shape="rect" alt="Learn about xxxxxxxx's Services" coords="98,21,202,40" href="http://www.facebook.com/xxxxxx?sk=app_?????" title="Learn about xxxxxxx's Services" /> <area shape="default" nohref="nohref" alt="" /></map></div> <?php } else { ?> <img src="http://xxxxx.com/facebook/landing/SRfanpage3.png" /> <?php } ?> </body> </html> I'm very new at this (not a php coder, just grabbed some code from a tutorial and am trying to make it work), so please be gentle. Thanks for your help in advance. Quote Link to comment https://forums.phpfreaks.com/topic/234057-html-inside-an-ifselse-not-working/ Share on other sites More sharing options...
KevinM1 Posted April 18, 2011 Share Posted April 18, 2011 A couple things: 1. You have a short PHP tag at the beginning of the line require 'facebook.php'; Change it from <? to <?php 2. Is the variable $like_status initialized anywhere? It's not defined in this file. Is it in facebook.php? Quote Link to comment https://forums.phpfreaks.com/topic/234057-html-inside-an-ifselse-not-working/#findComment-1202987 Share on other sites More sharing options...
Muddy_Funster Posted April 18, 2011 Share Posted April 18, 2011 what exactly is the problem? where is $like_status being assigned? what do you get if you echo $like_status just before the if? is that what it is supposed to be? Help us to help you Quote Link to comment https://forums.phpfreaks.com/topic/234057-html-inside-an-ifselse-not-working/#findComment-1202988 Share on other sites More sharing options...
noraft Posted April 18, 2011 Author Share Posted April 18, 2011 Wow, those were some fast replies. I'm basing this off the following tutorial, which I've apparently followed badly: http://www.hyperarts.com/blog/customizing-facebook-iframe-application-signed_request_reveal_tab/ I'm not sure of the answers to your question, so maybe that will answer them. Quote Link to comment https://forums.phpfreaks.com/topic/234057-html-inside-an-ifselse-not-working/#findComment-1202996 Share on other sites More sharing options...
Muddy_Funster Posted April 18, 2011 Share Posted April 18, 2011 you did this bit yeah? Note: If you called your index file "index.html" based on our earlier iFrame Page Tab tutorial, you will need to change the name to "index.php" and also change the file name in your Facebook Application settings (Facebook Integration > Page Tabs > Tab URL). Can we see the code from the other page (facebook.php or index.php). And personaly, I would need a map and compass to follow what's going on in that tutorial... Quote Link to comment https://forums.phpfreaks.com/topic/234057-html-inside-an-ifselse-not-working/#findComment-1203002 Share on other sites More sharing options...
dcro2 Posted April 18, 2011 Share Posted April 18, 2011 I think you forgot to add this: $page_id = $signed_request["page"]["id"]; $page_admin = $signed_request["page"]["admin"]; $like_status = $signed_request["page"]["liked"]; $country = $signed_request["user"]["country"]; $locale = $signed_request["user"]["locale"]; after $signed_request = $facebook->getSignedRequest(); Quote Link to comment https://forums.phpfreaks.com/topic/234057-html-inside-an-ifselse-not-working/#findComment-1203003 Share on other sites More sharing options...
noraft Posted April 18, 2011 Author Share Posted April 18, 2011 That fixed it! I thought that was only necessary when testing. Guess I read it wrong. I'd been working on code variations for 2 hours before posting here, so THANK YOU, thank you, a thousand times thank you. RESOLVED. Quote Link to comment https://forums.phpfreaks.com/topic/234057-html-inside-an-ifselse-not-working/#findComment-1203008 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.