Code Monkey home page Code Monkey logo

facebook's Introduction

Installation:
	Drop /facebook_comments/ into /system/expressionengine/third_party
	In the admin CP, go to Add-Ons->Modules
	Click install on the facebook_comments module
	Jquery must be installed on the page(s) you are using this module on in order for all features to work properly.  

Creating a facebook application:
	Log in to facebook and go to http://facebook.com/developers
	If asked, allow Developers access to your information. 
	Click "Create a New Application"
	Create an application with your chosen name
	Edit the application settings, and under Connect change the connect URL to the base URL of the site you are adding the module to (must end in / to be considered a directory, e.g. www.example.com/, not www.example.com)
	You may also need to set the post-authorization callback url. This is found under "Authorization" in the same control panel, and can be set to the same value as your Connect URL. 
	
Setup:
	Take the Application ID (Not the API Key) and the Application Secret and enter them into the module control panel (Add-Ons -> Modules -> Click Facebook Comments). 
	Change the default iFrame width to your desired setting. If left blank, this will assume 550px. 
	Change the desired posts-per-page setting. This only applies to the iFrame version, and will default to 10. 
	
XID Concept:
	An XID is an identification used by Facebook to identify a particular piece of data. For the purposes of this module, it is a unique identifier for a set of comments. Any tags that reference a particular set of comments will need to have this parameter passed to them. The best choice for XID's is usually the entry_id of whichever piece of content the comments refer to, but you can use any combination of letters and numbers. 

Template tagging/functions:
	{exp:facebook_comments:sdk}
		This adds the JS to load the facebook SDK. Should be added in the footer just after closing the body tag. No JS will work without this!
	{exp:facebook_comments:logBox}
		Creates a login/logout button (the javascript SDK will determine which needs to be displayed)	
	{exp:facebook_comments:getIframe}
		Creates a facebook comment iframe. No templating required for this- loads directly from  facebook's server.
		Params:
			xid: REQUIRED. This is an identifier for this comment set. Recommended to set this to the EE entry's id (e.g. xid="{entry_id}")
			width: overrides the default width set in the CP
			limit: overrides the default number of posts per screen set in the CP 

	{exp:facebook_comments:comments}
		Retrieves comments for templating (no iframe).

		Params:
			xid: REQUIRED. This is an identifier for this comment set. Recommended to set this to the EE entry's id (e.g. xid="{entry_id}")
			limit: Posts per page. Defaults to unlimited!
			offset: Page number, indexed from 0. 
			ajax: Set this (to anything non-null) to enable ajax pagination.
			nopagination: Set this (to anything non-null) to disable pagination. Useful in conjunction with limit for displaying a limited number of "preview" comments. 
			
		Variables:
			Every variable returned by the facebook API is exposed with the prefix "fb_". So, for instance, "text" would be accessible by {fb_text}. Also, any information returned about the user who made the comment is exposed with the prefix "fb_user_". So, the user's name would be "fb_user_name".
			Some useful examples:
				{fb_text} - Text of the comment
				{fb_fromid} -User who made the post's id
				{fb_user_name} - User's name
				{fb_time} - Time the comment was made.
			Additionally, a helper tag has been made:
				{fb_user_picture} - A link to the user's picture

			fb_time can be formatted with a standard PHP time formatting string with the syntax {fb_time="dateformat"}. fb_time defaults to "d/m/y h:m A" (e.g. 8/5/10 5:00 PM). 

	{exp:facebook_comments:comment_form}
		Returns a form for adding comments to a given XID. If the user is not logged in, this will display a login request instead, and will update to a comment form on login. 
		Params: 
			xid: REQUIRED. This is an identifier for this comment set. Recommended to set this to the EE entry's id (e.g. xid="{entry_id}")
	{exp:facebook_comments:numComments}
		Retrieves the number of comments made for a given xid
		Params:
			xid: REQUIRED. This is an identifier for this comment set. Recommended to set this to the EE entry's id (e.g. xid="{entry_id}")
			ajax: If set (to anything non-null): Instead of using PHP's synchronous API to make this call, embed a bit of javascript to retrieve this client-side. HIGHLY recommended, as this will greatly speed up page processing time.  

facebook's People

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.