Savallusion
#swipeproject
First off, a few things you might wonder.
What is SFBs?SFBs is a simple facebook commenting system. You can soon easily integrate facebook comments to the site you want it on!
What's different from the Facebook Comment system you can find
You must be registered for see links
?Well, this is in PHP and have integrated the PHP into the script. It also saves your application ID, width, siteurl and more in your database. I'm going to develop on this later on aswell, to include more things to do with the systems!
now, let's get on with the showcase. You all might already know, but facebook has a smaller script that does the same purpose. The main reason for why i made this, is that i want to learn, and i were kinda bored.. I figured this might be a good idea though, as i have a blogging software that i'm going to integrate this script with. The script will include an installation file, which i am currently working on, and the chance of editing whatever you'd like whenever you'd like.
If you want the script to integrate towards your own blog software, that shouldn't become a huge problem. All you'd have to do is put all necessary codes in wherever you want it. For it to work with your blog posts, i can provide some help if needed. But now it's been too much writing and reading for you. Here's a picture!
So far it's in a basic stage, and doesn't look too much of a big deal. However, this is easy to integrate with your own personal systems!
Here's the pre-release:
This must be put underneath your starting <body> tag for the best performance.
PHP:
<?php
include('config.php');
?>
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/nb_NO/all.js#xfbml=1&appId=<?php echo $appid; ?>";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
PHP:
<div class="fb-comments" data-href="<?php echo $sitelink; ?>" data-num-posts="2" data-width="<?php echo $width; ?>"></div>
PHP:
<?php
/*---------------------------------*\
| Simple facebook commenting system |
| by Sindre-Emil G. Marthinussen |
| *===============================* |
| http://sindreegmarth.com/ |
| *===============================* |
| This script is released under the |
| the public GNU license which can |
| be found at http://www.gnu.org. |
| *===============================* |
| Facebook Open Graph has been used |
| and included in this script. |
\*---------------------------------*/
$dbhost = "localhost"; //localhost as default
$dbuser = "root"; //Default is root
$dbpass = "yourpw"; //your password
$dbname = "opengraph"; //The database you wish to connect towards
/*do not do anything to the content underneath*/
$connect = mysql_connect($dbhost, $dbuser, $dbpass);
if (!$connect)
{
die("Couldn't connect to the database");
}
mysql_select_db($dbname, $connect) or die("Database doesn't exist, please check your settings!");
$apps = mysql_query('SELECT * FROM apps');
while ($row = mysql_fetch_array($apps))
{
$appid = $row['appid'];
}
$site = mysql_query('SELECT * FROM site');
while ($row = mysql_fetch_array($site))
{
$sitelink = $row['link'];
$width = $row['width'];
}
?>
You must be registered for see links
To insert your own appid, width and sitelink. You will have to go into the database and change those. I have for now, not made any systems to create this as i'm focusing on making the system easier to integrate!
Here's a temporary page to test it out:
PHP:
<?php
/*---------------------------------*\
| Simple facebook commenting system |
| by Sindre-Emil G. Marthinussen |
| *===============================* |
| http://sindreegmarth.com/ |
| *===============================* |
| This script is released under the |
| the public GNU license which can |
| be found at http://www.gnu.org. |
| *===============================* |
| Facebook Open Graph has been used |
| and included in this script. |
\*---------------------------------*/
?>
<html>
<head>
<title>Test page</title>
<style>
#box {
background-color: #eee;
border: 1px solid #ccc;
width: 600px;
margin:0 auto;
padding: 4px;
}
</style>
</head>
<body>
<?php
include('config.php');
?>
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/nb_NO/all.js#xfbml=1&appId=<?php echo $appid; ?>";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div id="box">
Hello world!<br />
<br />
<div class="fb-comments" data-href="<?php echo $sitelink; ?>" data-num-posts="2" data-width="<?php echo $width; ?>"></div>
</div>
</body>
</html>
You must be registered for see links
Remember, i'm still working on it. So don't start on being harsh on the comments!