Home Home




How to add Facebook comments to a custom/static XOOPS Module

A very simple process really. Just add a new center block bottom to your module and insert this little code:


<div id="fb-root"></div> <script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script> <fb:comments href="(NAME OF YOUR MODULE)>" num_posts="5" width="650"></fb:comments>


A working example at this site, for the Viking Name Generator:


<div id="fb-root"></div> <script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script> <fb:comments href="http://www.danordesign.com/modules/Viking-Name-Generator/>" num_posts="5" width="650"></fb:comments>


Change the width to fit your theme, and select how many posts you want visible.

Give the block a high number eg 9000 so that it will appear last on the page.

To add moderators, look at this post.

   
How to add Facebook comments to XOOPS AMS Module

The process is similar to adding Facebook comments and moderators to the Publisher Module, but the code is a bit different of course. To add Facebook comments to AMS (this module), use this code:


<div id="fb-root"></div>
<
script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<fb:comments href="<{$xoops_url}>/modules/AMS/article.php?storyid=<{$story.id}>" num_posts="5" width="650"></fb:comments>


To add moderators, look at this post.

   
How to add Facebook comments to XOOPS Publisher Module

To add Facebook comments to Publisher, just add a few lines of code in Publisher/templates/Publisher_item.html, just above the XOOPS comment system:


<div id="fb-root"></div>
<
script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<fb:comments href="<{$item.itemurl}>" num_posts="5" width="650"></fb:comments>


The advantage of having Facebook comments in Publisher, is that comments will also be posted on the users Facebook wall if he decides to do so. Default is ON. That means more traffic to your site, as friends will see the article he/she commented on.

To moderate Facebook comments on your site, you need to add a meta tag in your theme, between


<meta property="fb:admins" content="{YOUR_FACEBOOK_USER_ID}"/>


To add multiple moderators, add more than one element, each with one Facebook ID.

YOUR_FACEBOOK_USER_ID is typical something like this: 100007810858108

which will make the code to add:


<meta property="fb:admins" content="100007810858108" />


The disadvantage with Facebook comments, is that comments will vanish if the user disable his account or is deleted. But for traffic it is great!

   
How to make YouTube videos fit the XOOPS theme

Here is a trick how to embed YouTube videos to make them fit in all devices. Very useful if you use responsive themes:

First add a class in css:


.video-container {
    
positionrelative;
    
padding-bottom56.25%;
    
padding-top35px;
    
height0;
    
overflowhidden;
}
.
video-container iframe {
    
positionabsolute;
    
top:0;
    
left0;
    
width100%;
    
height100%;
}


Then add a div to the iframe for videos:


<div class="video-container"Embed code </div>


That will resize iframe embed code to fit the window

   
How to make Facebook fetch the article image in XOOPS Publisher module

To make Facebook fetch the correct article image in Publisher, you should add Meta tags to your theme and use a IF statement to make it invisible when on other modules. Add the following between your head tags in your theme:


<{if $xoops_dirname == "Publisher"}> 
        <
link rel="image_src" href="<{$item.image_path}>" /> 
        <
meta property="og:image" content="<{$item.image_path}>"/> 
        <
meta property="og:url" content="<{$item.itemurl}>"/> 
        <
meta itemprop="image" content="<{$item.image_path}>"/> 
        <
link rel="canonical" href="<{$item.itemurl}>"/>  
    <{/if}>


Facebook will use the tag and fetch the correct image. Without it, Facebook will grab any image off your site, and most times it is not relevant to the story.

   






 


 
Module Demos
Top Downloads




© 2009 - 2014 all right reserved | Danordesign - Free XOOPS Modules and PHP Scripts | Powered by XOOPS