<?php
if($url['pid'] == 1)
{
$on = settings('fb_like_on_homepage');
if($on['fb_like_on_homepage'] == 'y')
{
//add js to head if it isnt already
if(!strstr($page->page, '//connect.facebook.net/en_US/all.js'))
{
$mainhtml = str_replace('</head>', '<script src="//connect.facebook.net/en_US/all.js"></script><script>FB.init({status:true,cookie:true,xfbml:true});</script></head>', $mainhtml);
}
//add like button tag at the end of homepage content
$host = str_replace("www.", "", $_SERVER['SERVER_NAME']);
$host = ($host == 'demo.freesites.com.au') ? 'demo.freesites.com.au' : 'www.'.$host;
$mainhtml .= '<p style="clear:both;"><fb:like width="10" show_faces="false" layout="button_count" href="http://'.$host.'"></fb:like></p>';
}
}
?>