Printable Version of Topic

Click here to view this topic in its original format

Web Design Seo Forum _ Facebook tips _ How To Add Facebook Like In Joomla Content

Posted by: Web Design Seo Jul 1 2011, 12:12 PM

How to add "Facebook like" and "Facebook Send" in Joomla content and in some page in Joomla? How To Add Facebook Comments In Joomla Articles?

In all Joomla! Extensions Directory is no one good plugin to add facebook comments and facebook like. So, best way is to add comments from facebook manual, in php code of your joomla template - in article layout.

To add "Facebook like" in joomla articles, add this code in php code of your template:

Код
<?php $uriii = & JURI::getInstance(); ?>
<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=111923202235044&amp;xfbml=1"></script><fb:like href="<?php echo $uriii->_uri;?>" send="true" width="450" show_faces="false" font="tahoma"></fb:like>



This part will get current url - for Joomla 1.5:
Код
<?php $uriii = & JURI::getInstance(); ?>
<?php echo $uriii->_uri;?>


For Joomla 2.5 and Joomla 3:
Код
<?php $uriii = & JURI::current(); ?>
<?php echo $uriii; ?>



Parameters in facebook script:

- send: true or false
- width in pixels
- show_faces: true or false
- font: your font

To add "Facebook comments" in joomla articles, add this code in code of your template:

For Joomla 2.5 and Joomla 3:
Код
<?php $uriii = & JURI::current(); ?>
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<div class="fb-comments" data-href="<?php echo $uriii; ?>" data-numposts="5" data-colorscheme="light"></div>


For Joomla 1.5:
Код
<?php $uriii = & JURI::getInstance(); ?>
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<div class="fb-comments" data-href="<?php echo $uriii->_uri;?>" data-numposts="5" data-colorscheme="light"></div>


You can remove also:
Код
data-href="..."


In never versions of facebook scripts, script automatically detect url.

You can stylish div - for responsive comments design, add this to your css:
Код
.fb-comments, .fb-comments iframe[style], .fb-comments span { width: 100% !important; }



How to moderate facebook cooments?
Add this to head part of page (again in template):
Код
<meta property="fb:admins" content="your user id"/>

In this way this user id can moderate and delete bad comments.

Optional: If you want, you can create facebook application and add this part of code again in head:
Код
<meta property="fb:app_id" content="your app id">


In this way uou will get facebook like, comments and send for current url of current page in joomla. Work with sef or not-sef urls.
Enjoy smile.gif

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)