Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

Add Google+ Comments To Any Website

Asked Modified Viewed 5,036 times
H
HobbyMan
H
Just some Guy
  • Veteran Member, joined since
  • Contributed 1,486 posts on the community forums.
  • Started 91 threads in the forums
  • Started this discussions
asked
Veteran Member

via paulund

Example (News)

echo "<script src='https://apis.google.com/js/plusone.js'>
</script>";
echo"<center><div class='g-comments'
    data-href='".$settings['siteurl'].FUSION_SELF."?readmore=".$_GET['readmore']."'
    data-width='800'
    data-first_party_property='BLOGGER'
    data-view_type='FILTERED_POSTMOD'>
</div></center>\n";


Add this to news.php instead of showcomments

p.s. this has not been officially released by Google for non-blogger sites but works perfectly.
0 replies

4 posts

R
resbensen
R
  • Junior Member, joined since
  • Contributed 14 posts on the community forums.
  • Started 2 threads in the forums
answered
Junior Member

Works perfectly! Thank you kindly HobbyMan.
0 replies
H
HobbyMan
H
Just some Guy
  • Veteran Member, joined since
  • Contributed 1,486 posts on the community forums.
  • Started 91 threads in the forums
  • Started this discussions
answered
Veteran Member

See in action here: http://www.hobbysites.net/news.php?re...eadmore=79

It's easy, just rename includes/comments_include.php to comments_include_old.php
Copy & paste the code below, create a new file called comments_include.php and paste in the code.
Visitors should be able to comment using their Google+ accounts straight away.

<?php
/*-------------------------------------------------------+
| PHPFusion Content Management System
| Copyright (C) 2002 - 2014 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: comments_include.php
| Author: HobbyMan
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
if (!defined("IN_FUSION")) { die("Access Denied"); }

$ctype="";
$cdb="";
$ccol="";
$cid="";
$clink="";

function showcomments($ctype, $cdb, $ccol, $cid, $clink) {

global $settings, $locale, $userdata, $aidlink;

if (FUSION_SELF == "news.php") { $href=
FUSION_SELF."?readmore=".$_GET['readmore']; }
elseif (FUSION_SELF == "downloads.php") { $href=
FUSION_SELF."?cat_id=".$_GET['cat_id']."&download_id=".$_GET['download_id']; }
elseif (FUSION_SELF == "articles.php") { $href=
FUSION_SELF."?article_id=".$_GET['article_id']; }
elseif (FUSION_SELF == "photogallery.php") { $href=
FUSION_SELF."?photo_id=".$_GET['photo_id']; }
elseif (FUSION_SELF == "viewpage.php") { $href=
FUSION_SELF."?page_id=".$_GET['page_id']; }

opentable("Comments<span style='float:right;'><small><i>with
Google+</i></small>");
echo"<div style='margin: 0 auto;'>\n";
echo "<div class='g-comments'
data-href='".$settings['siteurl'].$href."'
data-width='600'
data-first_party_property='BLOGGER'
data-view_type='FILTERED_POSTMOD'>
</div></div>\n";
closetable();
}
?>


Comment Counter
<div class='g-commentcount' data-href=[URL]'></div>


Four things:
1. This is a BETA release as it's not been fully tested yet.
2. Google have not officially released this for non-blogger sites although it works perfectly.
3. This will not affect any existing comments in your database at all.
4. Just rename or reload original comments_include.php to revert back.
0 replies
P
PolarFox
P
  • Veteran Member, joined since
  • Contributed 1,633 posts on the community forums.
  • Started 29 threads in the forums
answered
Veteran Member

shortcut:
margin:0 auto;

top/bottom = 0 + right/left = auto
0 replies
C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
answered
Fusioneer

Nice Phil. Thanks! :)

Don't use <center> though it's deprecated. Just add to your div style='margin-left:auto; margin-right: auto;' to center it instead.

<div class='g-comments' style='margin-left:auto; margin-right: auto;'

If that does not center it just add another div outside that g-comments div.
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 4 posts
  • Votes 0 votes
  • Topic users 4 members

4 participants

C
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
H
H
Just some Guy
  • Veteran Member, joined since
  • Contributed 1,486 posts on the community forums.
  • Started 91 threads in the forums
  • Started this discussions
P
P
  • Veteran Member, joined since
  • Contributed 1,633 posts on the community forums.
  • Started 29 threads in the forums
R
R
  • Junior Member, joined since
  • Contributed 14 posts on the community forums.
  • Started 2 threads in the forums

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet