Facebook Comments
6 posts by 3 authors in: Forums > CMS Builder
Last Post: June 20, 2013 (RSS)
Hi all,
Right now my actual blog (facebook comments) is not recognizing each post as it's own page. So when I click on the first post for ex. and write testing 123 etc., that same comment will show up for every post. ex. I go to the details page on the next post, and the same comments are there from other pages. I went in and changed the FB code, but still no change. It's not much of a blog if the comments are not specific to each article. I've used FB comments on other websites with CMS Builder and have not had this problem. Any thoughts on what the issue might be?
Thanks,
ko19
By Jason - June 18, 2013
Hi,
Would you be able to post the code you are using for comments on your detail pages? Facebook comments are a 3rd Party script, but I can take a look and let you know if I see any issues.
Hope this helps
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Ok Jason, thankyou. yes, like I said, I've used FB comments on other Site with CMS builder and never had this problem. Find below:
<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
// load viewer library
$libraryPath = 'cmsAdmin/lib/viewer_functions.php';
$dirsToCheck = array('/home/enlig124/public_html/','','../','../../','../../../');
foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }
// load detail record from 'ets_blog'
list($ets_blogRecords, $ets_blogMetaData) = getRecords(array(
'tableName' => 'ets_blog',
'where' => whereRecordNumberInUrl(1), // If no record # is specified then latest record is shown
'loadUploads' => true,
'allowSearch' => false,
'limit' => '1',
));
$detailRecord = @$ets_blogRecords[0]; // get first record
if (!$detailRecord) { dieWith404("Record not found!"); } // show error message if no record found
?><!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>
<title>Tara Preston - The Full Story</title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<style type="text/css">
body { font-family: arial; }
.instructions { border: 3px solid #000; background-color: #EEE; padding: 10px; text-align: left; margin: 25px}
</style>
</head>
<body>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="keywords" content="Akashic Record Readings, Akashic records, Akasha, soul healing, holistic healing, Intuitive Healing, energy healing, energy therapy, healing touch practitioner, authentic, soul-level, soul discovery, purpose, life purpose, soul purpose, heal, clear energetic blocks, soul realignment, intuitive, coaching, guidance, spiritual healing, remove blocks, clear patterns, life purpose, intuitive reading, co-create, manifest, clear blocks, soul groups, inspired creative living, self-love, feminine flow, heart centered living, energetic alignment, success, passion, spirit guides, professional intuitive, healer, past life healing, tara preston, tara favreau, soul gifts, gifts, relationship healing, divine guidance, intuitive support, chakra healing, soul realignment pracitioner" />
<meta name="description" content="Akashic Record Readings from Enlighten the Soul" />
<meta name="author" content="Tara Preston www.enlightenthesoul.com" />
<meta name="copyright" content="www.enlightenthesoul.com, Tara Preston" />
<meta name="distribution" content="Global" />
<meta name="revisit-after" content="30 days" />
<meta name="robots" content="home, follow" />
<meta name="url" content="http://www.enlightenthesoul.com/" />
<meta name="language" content="English" />
<meta name="viewport" content="width=device-width">
<link rel="canonical" href="">
<link rel="icon" type="image/ico" href="favicon.ico">
<link href="style.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="colorbox.css" />
<script src="js/jquery.min.js"></script>
<script src="js/jquery.colorbox.js"></script>
<script>
$(document).ready(function(){
//Examples of how to assign the Colorbox event to elements
$(".vimeo").colorbox({iframe:true, innerWidth:500, innerHeight:409});
$(".iframe").colorbox({iframe:true, width:580, height:870});
$(".iframe1").colorbox({iframe:true, width:624, height:360});
$(".iframe2").colorbox({iframe:true, width:580, height:1060});
$(".callbacks").colorbox({
onOpen:function(){ alert('onOpen: colorbox is about to open'); },
onLoad:function(){ alert('onLoad: colorbox has started to load the targeted content'); },
onComplete:function(){ alert('onComplete: colorbox has displayed the loaded content'); },
onCleanup:function(){ alert('onCleanup: colorbox has begun the close process'); },
onClosed:function(){ alert('onClosed: colorbox has completely closed'); }
});
$('.non-retina').colorbox({rel:'group5', transition:'none'})
$('.retina').colorbox({rel:'group5', transition:'none', retinaImage:true, retinaUrl:true});
//Example of preserving a JavaScript event for inline calls.
$("#click").click(function(){
$('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here.");
return false;
});
});
</script>
<body>
<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/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div id="main_contain">
<div id="inner_contain">
<div id="header">
<div id="logo"><img src="images/logo.png" width="518" height="367" usemap="#Map">
<map name="Map">
<area shape="rect" coords="100,9,466,157" href="index.php">
</map>
</div>
<div id="right_header">
<div id="right_text">Tara Preston<br>
Soul Purpose Expert, <br>
Intuitive</div>
</div>
<div id="navigation">
<div id="main_menu">
<ul id="coolMenu">
<li><a href="index.php">Home</a></li>
<li><a class='iframe' href="about.php">About</a></li>
<li><a href="blog.php" class="current_page" style="color:#000;">Blog</a></li>
<li><a href="service.php">Services</a>
<!-- <ul class="noJS">
<li><a href="full_story.html">Full Story</a></li>
<li><a class="various3" href="faq.html">FAQ</a></li>
</ul>-->
</li>
<li><a class='iframe2' href="testimonial.php">Testimonials</a></li>
<li><a href="contact.php">Connect</a></li>
</ul>
</div>
</div>
</div>
<div id="lower_main">
<div id="tesimonial_blog">
<div class="test_text3">"suscipit lobortis nisl ut aliquip ex ea commodo<br>
consequat. Duis autem vel eum iriure ipsum dolor sit amet,<br>
elit sed diam."</div>
</div>
<div id="full_heading"><?php echo htmlencode($detailRecord['title']) ?></div>
<div id="full_sheading"><?php echo htmlencode($detailRecord['title_2']) ?></div>
<div id="full_texcontain"><?php echo $detailRecord['content']; ?></div>
<div id="full_facecomment">
<div class="fb-comments" data-href="http://www.facebook.com/pages/Enlighten-The-Soul/326234864064583" data-width="745" data-num-posts="10"></div>
</div>
<div id="full_pagenavi"><a href="<?php echo $ets_blogMetaData['_listPage'] ?>"><< Back to list page</a> - <a href="mailto:?subject=<?php echo urlencode(thisPageUrl()) ?>">Email this Page</a></div>
</div>
<div id="lower_socialcontain"><a href="#"><img src="images/rss.png" width="30" height="30"></a><a href="https://twitter.com/ElightentheSoul" target="_blank"><img src="images/twitter.png" width="30" height="30"></a><a href="http://www.youtube.com/channel/UCd8MdEUYkeUHjHPtl4juyOA" target="_blank"><img src="images/you_tube.png" width="30" height="30"></a><a href="https://www.facebook.com/pages/Enlighten-The-Soul/326234864064583"><img src="images/facebook.png" width="30" height="30"></a></div>
</div>
<div id="fot_contain">
<div id="fot_innercontain">
<p> </p>
</div>
<div id="fot_cor"><img src="images/fill.gif" width="86" height="42"></div>
</div>
</div>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-40427183-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</body>
</html>
By gregThomas - June 19, 2013
Hi,
I think the problem might be that your div for the Facebook comments doesn't contain the URL for the current page in the data-href, it needs to contain the full URL of the current page. You could find the current full URL using these functions:
function strleft($s1, $s2) { return substr($s1, 0, strpos($s1, $s2)); }
function selfURL() {
$s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : "";
$protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s;
$port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]);
return $protocol."://".$_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI'];
}
Then on the div with the class fb-comments you need to amend data-href tag to contain the current page URL:
<div class="fb-comments" data-href="<?php echo selfURL(); ?>" data-width="745" data-num-posts="10"></div>
Let me know if you have any questions.
Thanks!
Greg
PHP Programmer - interactivetools.com
By gregThomas - June 19, 2013
I've just found out there is a function built into CMS Builder that will return the current pages full URL which you could instead. Then you would only need to modify the facebook comments line to look like this:
<div class="fb-comments" data-href="<?php echo thisPageUrl(); ?>" data-width="745" data-num-posts="10"></div>
Thanks!
Greg
PHP Programmer - interactivetools.com
super...this is what I was looking for :) Thanks Greg, much appreciated.