Facebook Comments
4 posts by 2 authors in: Forums > CMS Builder
Last Post: May 17, 2011 (RSS)
By design9 - May 13, 2011
Hello, I am not sure if you can help with this or not but wanted to give it a shot.
I have placed the facebook comments box on our blog page. The code works fine and I can post a comment to my facebook page with no problem. The issue arises when I am on my facebook page and try to clcik on the link that the facebook comments widget shares on my facebook page. It is pulling the link correctly dynamically as I put this (<?=$_SERVER['REQUEST_URI'[/#336699]]?> ) into the facebook href coding area to get the current url of the page.
<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:comments href="[url "http://www.charlotteparent.com<?=$_SERVER['REQUEST_URI'"]http://www.charlotteparent.com<?=$_SERVER['REQUEST_URI'[/url]]?>" num_posts="5" width="500"></fb:comments>
The issue is when I click on the url through facebook and it takes me to the page, none of the blog data shows up from my cms which is where the blogs are built. I can't figure out if there is something wrong with my cms coding however when I get the url that facebook creates, it looks like this
http://www.charlotteparent.com/community/blogsnew/details.php?Stuart-Little-Inspires-On-Stage-1&fb_comment_id=fbc_10150239761415708_16839446_10150247994020708#f3baa4b18ff257
which proposes there is something there causing the issue. This happens on any page that I have data from the cms and doesn't on a regular page that doesn't have any cms data being pulled in. I have included my details php file and screenshots in case that helps. I understand that you all may not be able to help with this as it may be something with facebook but wanted to check to see if you all could see something I am missing.
1. Blog-Page-with-comment-box.jpg - (my main blog page with comment box)[/#000000]
2. facebook-page.jpg - (my facebook page that shares url of page that I commented on) [/#000000]
3. Page from facebook link.jpg - (page once I click on the link that was shared on facebook...no data being pulled in.)[/#000000]
I have placed the facebook comments box on our blog page. The code works fine and I can post a comment to my facebook page with no problem. The issue arises when I am on my facebook page and try to clcik on the link that the facebook comments widget shares on my facebook page. It is pulling the link correctly dynamically as I put this (<?=$_SERVER['REQUEST_URI'[/#336699]]?> ) into the facebook href coding area to get the current url of the page.
<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:comments href="[url "http://www.charlotteparent.com<?=$_SERVER['REQUEST_URI'"]http://www.charlotteparent.com<?=$_SERVER['REQUEST_URI'[/url]]?>" num_posts="5" width="500"></fb:comments>
The issue is when I click on the url through facebook and it takes me to the page, none of the blog data shows up from my cms which is where the blogs are built. I can't figure out if there is something wrong with my cms coding however when I get the url that facebook creates, it looks like this
http://www.charlotteparent.com/community/blogsnew/details.php?Stuart-Little-Inspires-On-Stage-1&fb_comment_id=fbc_10150239761415708_16839446_10150247994020708#f3baa4b18ff257
which proposes there is something there causing the issue. This happens on any page that I have data from the cms and doesn't on a regular page that doesn't have any cms data being pulled in. I have included my details php file and screenshots in case that helps. I understand that you all may not be able to help with this as it may be something with facebook but wanted to check to see if you all could see something I am missing.
1. Blog-Page-with-comment-box.jpg - (my main blog page with comment box)[/#000000]
2. facebook-page.jpg - (my facebook page that shares url of page that I commented on) [/#000000]
3. Page from facebook link.jpg - (page once I click on the link that was shared on facebook...no data being pulled in.)[/#000000]
Re: [design9] Facebook Comments
By Jason - May 16, 2011
Hi,
What's happening is here:
The function whereRecordNumberInUrl() is getting the last number in the URL and attempting to use this as a record number. In this case, it's using the variable fb_comment_id.
What we can do, is temporarily strip this variable out just long enough to do our query, then put it back in.
Try this:
Hope this helps
What's happening is here:
list($blogpageRecords, $blogpageMetaData) = getRecords(array(
'tableName' => 'blogpage',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
The function whereRecordNumberInUrl() is getting the last number in the URL and attempting to use this as a record number. In this case, it's using the variable fb_comment_id.
What we can do, is temporarily strip this variable out just long enough to do our query, then put it back in.
Try this:
$fb_comment_id = @$_REQUEST['fb_comment_id'];
$_REQUEST['fb_comment_id'] = "";
list($blogpageRecords, $blogpageMetaData) = getRecords(array(
'tableName' => 'blogpage',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$blogpageRecord = @$blogpageRecords[0]; // get first record
$_REQUEST['fb_comment_id'] = $fb_comment_id;
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/
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] Facebook Comments
By design9 - May 16, 2011
Jason, I tried this and it doesn't seem to work. Can you look at my page and see if I am missing anything? Also, it was my blogsrecord that is pulling the blog data so I updated that.
Thanks!
April
Thanks!
April
Re: [design9] Facebook Comments
By Jason - May 17, 2011
Hi April,
I took a closer look into this, and it turns out that the function whereRecordNumberInUrl() function gets data from $_SERVER['QUERY_STRING'], and not the $_REQUEST array. But we can still use a similar technique, try this:
Hope this helps.
I took a closer look into this, and it turns out that the function whereRecordNumberInUrl() function gets data from $_SERVER['QUERY_STRING'], and not the $_REQUEST array. But we can still use a similar technique, try this:
$tmpQueryString = $_SERVER['QUERY_STRING'];
$queryArray = explode("&", $_SERVER['QUERY_STRING']);
$_SERVER['QUERY_STRING'] = $queryArray[0];
list($blogsRecords, $blogsMetaData) = getRecords(array(
'tableName' => 'blogs',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$blogsRecord = @$blogsRecords[0]; // get first record
$_SERVER['QUERY_STRING'] = $tmpQueryString;
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/
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/