SlideShare une entreprise Scribd logo
1  sur  39
Social Network Integration By John Michael Vincent D. Dalisay Jr. Software Developer
Contents Social Networking Service How important is SNS Video Sample Applications Descriptions and Screenshots Coding JavaScript with FB.ui and Twitter Widget Using Facebook PHP SDK
social networking service A social networking service is an online service, platform, or site that focuses on building and reflecting of social networks or social relations among people, e.g., who share interests and/or activities.  Most of them are web based. E.g. (facebook, twitter)
How important/useful is this? See video: http://www.youtube.com/watch?v=GSlN1cAYQxA
Sample Applications http://www.eforuli.com - Online ePUB e-Book Storage. Store, Download, Read and Share your E-Books. DO-CMS websites: http://www.calleza.com/
http://www.eforuli.com The user can share an ebook to facebook or twitter with his review and rating. The site eforuli.com will be known to his facebook friends or twitter followers.
http://www.eforuli.com
http://www.eforuli.com The user can share list of links of ebooks to facebook. So it is possible for his facebook friends to view lots of ebook profile at eforuli.com. His friends could also be encouraged to sign up for an eforuli account.
http://www.eforuli.com
http://www.calleza.com/ Special shows/events shown on their home page can be shared to facebook or twitter
http://www.calleza.com/
http://www.calleza.com/ Calleza.com facebook page photos are synced to their website photos. We save server disk space since the photos are stored in facebook and not in our server.
http://www.calleza.com/ (site album)
http://www.calleza.com/ (FB album)
http://www.calleza.com/ We can also get the events created from their facebook page and post it on their website.
Coding Sharing via FB.ui and Twitter Widget Using Facebook PHP SDK
Sharing via FB.ui and Twitter Widget We will code about how to share site contents to user’s facebook wall and twitter account.
JavaScript with FB.ui Create an app for your site: https://developers.facebook.com/setup Your App ID and App Secret ID will be generated.
JavaScript with FB.ui Include the following in your php document <div id="fb-root"></div> <script src="http://connect.facebook.net/en_US/all.js"></script>
JavaScript with FB.ui Create your function. Include variables for data to be displayed. <script type='text/javascript'> 	function post_to_wall( event_id, event_title, event_date){ 	} </script>
JavaScript with FB.ui Place the following inside your function. FB.init({  			appId:'178864032154187',  cookie:true,  status:true,  xfbml:true 		}); appId– is the App ID generated on App Creation earlier.
JavaScript with FB.ui Place the following underFB.init code. This is where we specify the default contents of the post FB.ui( 	{ 	method: 'feed', 	name: event_title + ' on ' + event_date, 	link: 'http://www.calleza.com/', 	picture: 'http://www.calleza.com/event_image_fb.php?id=' + event_id, 	caption: 'Events @ Calleza Grill', 	description: 'Calleza Grill is Antipolo’s premiere live music venue. This bar and restaurant has evolved into one of the best live music venues in the area. Calleza is the ideal venue for your night out.', 	message: 'Hi friends! Calleza Grill will be having a great show on ' + event_date + '!' 	}, );
JavaScript with FB.ui Place the following insideFB.ui function if you want the user prompted with a publishing confirmation. 	function(response) { 		if (response && response.post_id) { 			alert('Post was published.'); 		}else{ 			//alert('Post was not published.'); 		} 	}
JavaScript with FB.ui Given the values to be processed, the button code would be something like this: <input type='button'     value='Share on Facebook‘    class='share-buttons'  onClick='post_to_wall( <?php echo $event_id; ?>, "<?php echo $event_title; ?>", "<?php echo $start_date; ?>" )'  id='fbbtn' />
That was the code used here…
JavaScript with Twitter Widget We’ll proceed with the codes on sharing via twitter. Unlike facebook, you don’t have to create an app in twitter, just include the widget: <script src="http://platform.twitter.com/widgets.js" type="text/javascript"> </script>
JavaScript with Twitter Widget Create your function <script type='text/javascript'> 	function share_on_twitter( event_title, event_date ){ 	} </script>
JavaScript with Twitter Widget Inside your function, you should have code something like this: varurl = "http://www.calleza.com/"; vartext = "In Calleza Grill: " + event_title + " on " + event_date + "!"; window.open("http://twitter.com/share?count=horizontal&original_referer=http://www.calleza.com/&text=" + text + "&url=" + url,'name','height=300,width=500,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,top=20,left=20');
JavaScript with Twitter Widget Given the values to be processed, the button code would be something like this: <input type='button' value='Share on Twitter' class='share-buttons' onClick='share_on_twitter( "<?php echo $event_title; ?>", "<?php echo $start_date; ?>" )' id='twitterbtn' />
And that was the code used here…
Using Facebook PHP SDK We will retrieve photo albums from a facebook page and display it on a website.
Using Facebook PHP SDK Download PHP SDK here: https://github.com/facebook/php-sdk/ Store the SDK in your web directory
Using Facebook PHP SDK Include the following code in your php document: include 'calleza/FQL/fb-sdk/src/facebook.php'; 	$facebook = new Facebook(array( 	  'appId'  => '178864032154187', 	  'secret' => '910dfaf91735b2c3422e0b0756a32902', 	  'cookie' => true, // enable optional cookie support 	)); facebook.php – included in the SDK appId and secret – generated when we created an app earlier
Using Facebook PHP SDK Next is the following code. Facebook query language (FQL) is just like SQL. The following queries the albums of the facebook page. 	echo "<p style='font-weight: bold;'>Calleza Grill Photo Albums</p>"; 	$fql    =   "SELECT aid, cover_pid, name FROM album WHERE owner=217052582900 and aid != '217052582900_225185' and aid != '217052582900_131309'"; 	$param  =   array( 	 'method'    => 'fql.query', 	 'query'     => $fql, 	 'callback'  => '' 	); 	$fqlResult   =   $facebook->api($param);
Using Facebook PHP SDK Next, we’re gonna loop throught the albums and create another query to get the album cover image. foreach( $fqlResult as $keys => $values ){ 		//to get album cover 		$fql2    =   "select src from photo where pid = '" . $values['cover_pid'] . "'"; 		$param2  =   array( 		 'method'    => 'fql.query', 		 'query'     => $fql2, 		 'callback'  => '' 		); 		$fqlResult2   =   $facebook->api($param2); foreach( $fqlResult2 as $keys2 => $values2){ 			$album_cover = $values2['src']; 		} 		echo "<div style='padding: 10px; width: 150px; height: 170px; float: left;'>"; 		echo "<a href='http://www.calleza.com/10/Photo-Gallery/?action=list_pics&aid=" . $values['aid'] . "&name=" . $values['name'] . "'>"; 			echo "<imgsrc='$album_cover' border='1'>"; 		echo "</a><br />"; 		echo $values['name']; 		echo "</div>"; 	}
And that was the code used in here…
Using Facebook PHP SDK There are so many other data that we can query from facebook. For more info, visit https://developers.facebook.com/docs/reference/api/
References Wikipedia https://developers.facebook.com http://www.smartbcn.com/
The End

Contenu connexe

En vedette

Human computer interaction
Human computer interactionHuman computer interaction
Human computer interactionsai anjaneya
 
SET Software Engineering Thailand Meeting: HCI / Usability Patterns
SET Software Engineering Thailand Meeting: HCI / Usability PatternsSET Software Engineering Thailand Meeting: HCI / Usability Patterns
SET Software Engineering Thailand Meeting: HCI / Usability PatternsProf. Dr. Roland Petrasch
 
Market Research Report : Project logistics market in india 2014 - Sample
Market Research Report : Project logistics market in india 2014 - SampleMarket Research Report : Project logistics market in india 2014 - Sample
Market Research Report : Project logistics market in india 2014 - SampleNetscribes, Inc.
 
Distributed system unit II according to syllabus of RGPV, Bhopal
Distributed system unit II according to syllabus of  RGPV, BhopalDistributed system unit II according to syllabus of  RGPV, Bhopal
Distributed system unit II according to syllabus of RGPV, BhopalNANDINI SHARMA
 
Human-Computer Interaction
Human-Computer InteractionHuman-Computer Interaction
Human-Computer InteractionTarek Amr
 
project report of social networking web sites
project report of social networking web sitesproject report of social networking web sites
project report of social networking web sitesGyanendra Pratap Singh
 
Distributed system notes unit I
Distributed system notes unit IDistributed system notes unit I
Distributed system notes unit INANDINI SHARMA
 
Social Networking Project
Social Networking ProjectSocial Networking Project
Social Networking Projectjessduff44
 
Introduction to HCI
Introduction to HCI Introduction to HCI
Introduction to HCI Deskala
 
USER INTERFACE DESIGN PPT
USER INTERFACE DESIGN PPTUSER INTERFACE DESIGN PPT
USER INTERFACE DESIGN PPTvicci4041
 
Research Project Report on Growth of Venture Capital Finance in India and Rol...
Research Project Report on Growth of Venture Capital Finance in India and Rol...Research Project Report on Growth of Venture Capital Finance in India and Rol...
Research Project Report on Growth of Venture Capital Finance in India and Rol...Piyush Gupta
 
Social Networking Project (website) full documentation
Social Networking Project (website) full documentation Social Networking Project (website) full documentation
Social Networking Project (website) full documentation Tenzin Tendar
 
human computer interface
human computer interfacehuman computer interface
human computer interfaceSantosh Kumar
 

En vedette (20)

Human computer interaction
Human computer interactionHuman computer interaction
Human computer interaction
 
SET Software Engineering Thailand Meeting: HCI / Usability Patterns
SET Software Engineering Thailand Meeting: HCI / Usability PatternsSET Software Engineering Thailand Meeting: HCI / Usability Patterns
SET Software Engineering Thailand Meeting: HCI / Usability Patterns
 
Market Research Report : Project logistics market in india 2014 - Sample
Market Research Report : Project logistics market in india 2014 - SampleMarket Research Report : Project logistics market in india 2014 - Sample
Market Research Report : Project logistics market in india 2014 - Sample
 
Distributed system unit II according to syllabus of RGPV, Bhopal
Distributed system unit II according to syllabus of  RGPV, BhopalDistributed system unit II according to syllabus of  RGPV, Bhopal
Distributed system unit II according to syllabus of RGPV, Bhopal
 
Social networking
Social networkingSocial networking
Social networking
 
Symmetric and asymmetric key
Symmetric and asymmetric keySymmetric and asymmetric key
Symmetric and asymmetric key
 
social networking site
social networking sitesocial networking site
social networking site
 
Human-Computer Interaction
Human-Computer InteractionHuman-Computer Interaction
Human-Computer Interaction
 
Distributed Systems
Distributed SystemsDistributed Systems
Distributed Systems
 
project report of social networking web sites
project report of social networking web sitesproject report of social networking web sites
project report of social networking web sites
 
Distributed system notes unit I
Distributed system notes unit IDistributed system notes unit I
Distributed system notes unit I
 
Social Networking Project
Social Networking ProjectSocial Networking Project
Social Networking Project
 
WIRELES NETWORK
WIRELES NETWORKWIRELES NETWORK
WIRELES NETWORK
 
Introduction to HCI
Introduction to HCI Introduction to HCI
Introduction to HCI
 
cryptography
cryptographycryptography
cryptography
 
USER INTERFACE DESIGN PPT
USER INTERFACE DESIGN PPTUSER INTERFACE DESIGN PPT
USER INTERFACE DESIGN PPT
 
Research Project Report on Growth of Venture Capital Finance in India and Rol...
Research Project Report on Growth of Venture Capital Finance in India and Rol...Research Project Report on Growth of Venture Capital Finance in India and Rol...
Research Project Report on Growth of Venture Capital Finance in India and Rol...
 
Cryptography
CryptographyCryptography
Cryptography
 
Social Networking Project (website) full documentation
Social Networking Project (website) full documentation Social Networking Project (website) full documentation
Social Networking Project (website) full documentation
 
human computer interface
human computer interfacehuman computer interface
human computer interface
 

Dernier

Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 

Dernier (20)

Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 

Social Network Integration

  • 1. Social Network Integration By John Michael Vincent D. Dalisay Jr. Software Developer
  • 2. Contents Social Networking Service How important is SNS Video Sample Applications Descriptions and Screenshots Coding JavaScript with FB.ui and Twitter Widget Using Facebook PHP SDK
  • 3. social networking service A social networking service is an online service, platform, or site that focuses on building and reflecting of social networks or social relations among people, e.g., who share interests and/or activities. Most of them are web based. E.g. (facebook, twitter)
  • 4. How important/useful is this? See video: http://www.youtube.com/watch?v=GSlN1cAYQxA
  • 5. Sample Applications http://www.eforuli.com - Online ePUB e-Book Storage. Store, Download, Read and Share your E-Books. DO-CMS websites: http://www.calleza.com/
  • 6. http://www.eforuli.com The user can share an ebook to facebook or twitter with his review and rating. The site eforuli.com will be known to his facebook friends or twitter followers.
  • 8. http://www.eforuli.com The user can share list of links of ebooks to facebook. So it is possible for his facebook friends to view lots of ebook profile at eforuli.com. His friends could also be encouraged to sign up for an eforuli account.
  • 10. http://www.calleza.com/ Special shows/events shown on their home page can be shared to facebook or twitter
  • 12. http://www.calleza.com/ Calleza.com facebook page photos are synced to their website photos. We save server disk space since the photos are stored in facebook and not in our server.
  • 15. http://www.calleza.com/ We can also get the events created from their facebook page and post it on their website.
  • 16. Coding Sharing via FB.ui and Twitter Widget Using Facebook PHP SDK
  • 17. Sharing via FB.ui and Twitter Widget We will code about how to share site contents to user’s facebook wall and twitter account.
  • 18. JavaScript with FB.ui Create an app for your site: https://developers.facebook.com/setup Your App ID and App Secret ID will be generated.
  • 19. JavaScript with FB.ui Include the following in your php document <div id="fb-root"></div> <script src="http://connect.facebook.net/en_US/all.js"></script>
  • 20. JavaScript with FB.ui Create your function. Include variables for data to be displayed. <script type='text/javascript'> function post_to_wall( event_id, event_title, event_date){ } </script>
  • 21. JavaScript with FB.ui Place the following inside your function. FB.init({ appId:'178864032154187', cookie:true, status:true, xfbml:true }); appId– is the App ID generated on App Creation earlier.
  • 22. JavaScript with FB.ui Place the following underFB.init code. This is where we specify the default contents of the post FB.ui( { method: 'feed', name: event_title + ' on ' + event_date, link: 'http://www.calleza.com/', picture: 'http://www.calleza.com/event_image_fb.php?id=' + event_id, caption: 'Events @ Calleza Grill', description: 'Calleza Grill is Antipolo’s premiere live music venue. This bar and restaurant has evolved into one of the best live music venues in the area. Calleza is the ideal venue for your night out.', message: 'Hi friends! Calleza Grill will be having a great show on ' + event_date + '!' }, );
  • 23. JavaScript with FB.ui Place the following insideFB.ui function if you want the user prompted with a publishing confirmation. function(response) { if (response && response.post_id) { alert('Post was published.'); }else{ //alert('Post was not published.'); } }
  • 24. JavaScript with FB.ui Given the values to be processed, the button code would be something like this: <input type='button' value='Share on Facebook‘ class='share-buttons' onClick='post_to_wall( <?php echo $event_id; ?>, "<?php echo $event_title; ?>", "<?php echo $start_date; ?>" )' id='fbbtn' />
  • 25. That was the code used here…
  • 26. JavaScript with Twitter Widget We’ll proceed with the codes on sharing via twitter. Unlike facebook, you don’t have to create an app in twitter, just include the widget: <script src="http://platform.twitter.com/widgets.js" type="text/javascript"> </script>
  • 27. JavaScript with Twitter Widget Create your function <script type='text/javascript'> function share_on_twitter( event_title, event_date ){ } </script>
  • 28. JavaScript with Twitter Widget Inside your function, you should have code something like this: varurl = "http://www.calleza.com/"; vartext = "In Calleza Grill: " + event_title + " on " + event_date + "!"; window.open("http://twitter.com/share?count=horizontal&original_referer=http://www.calleza.com/&text=" + text + "&url=" + url,'name','height=300,width=500,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,top=20,left=20');
  • 29. JavaScript with Twitter Widget Given the values to be processed, the button code would be something like this: <input type='button' value='Share on Twitter' class='share-buttons' onClick='share_on_twitter( "<?php echo $event_title; ?>", "<?php echo $start_date; ?>" )' id='twitterbtn' />
  • 30. And that was the code used here…
  • 31. Using Facebook PHP SDK We will retrieve photo albums from a facebook page and display it on a website.
  • 32. Using Facebook PHP SDK Download PHP SDK here: https://github.com/facebook/php-sdk/ Store the SDK in your web directory
  • 33. Using Facebook PHP SDK Include the following code in your php document: include 'calleza/FQL/fb-sdk/src/facebook.php'; $facebook = new Facebook(array( 'appId' => '178864032154187', 'secret' => '910dfaf91735b2c3422e0b0756a32902', 'cookie' => true, // enable optional cookie support )); facebook.php – included in the SDK appId and secret – generated when we created an app earlier
  • 34. Using Facebook PHP SDK Next is the following code. Facebook query language (FQL) is just like SQL. The following queries the albums of the facebook page. echo "<p style='font-weight: bold;'>Calleza Grill Photo Albums</p>"; $fql = "SELECT aid, cover_pid, name FROM album WHERE owner=217052582900 and aid != '217052582900_225185' and aid != '217052582900_131309'"; $param = array( 'method' => 'fql.query', 'query' => $fql, 'callback' => '' ); $fqlResult = $facebook->api($param);
  • 35. Using Facebook PHP SDK Next, we’re gonna loop throught the albums and create another query to get the album cover image. foreach( $fqlResult as $keys => $values ){ //to get album cover $fql2 = "select src from photo where pid = '" . $values['cover_pid'] . "'"; $param2 = array( 'method' => 'fql.query', 'query' => $fql2, 'callback' => '' ); $fqlResult2 = $facebook->api($param2); foreach( $fqlResult2 as $keys2 => $values2){ $album_cover = $values2['src']; } echo "<div style='padding: 10px; width: 150px; height: 170px; float: left;'>"; echo "<a href='http://www.calleza.com/10/Photo-Gallery/?action=list_pics&aid=" . $values['aid'] . "&name=" . $values['name'] . "'>"; echo "<imgsrc='$album_cover' border='1'>"; echo "</a><br />"; echo $values['name']; echo "</div>"; }
  • 36. And that was the code used in here…
  • 37. Using Facebook PHP SDK There are so many other data that we can query from facebook. For more info, visit https://developers.facebook.com/docs/reference/api/

Notes de l'éditeur

  1. Special shows/events shown on their home page can be shared to facebook or twitter