الانتقال السريع

شقق للبيع , سيارت للبيع , محلات للاجار ,شقق للاجار!, ارقام تلفونات, ارقام سيارات مميزه ,ملابس للبيع محلات للبيع , !مجوهرات وضائف

السبت، 17 مارس 2012

Facebook like PHP script


We’ve seen the facebook like button everywhere right? But the crappy thing is that you have to copy-and-paste the facebook iframe code that has to be then edited. Lets fix this right now.
I created a PHP function called facebook_like() which can be called anywhere where you want to show the facebook like button. For more info on the facebook like button go here :http://developers.facebook.com/docs/reference/plugins/like
COPY AND PASTE:
<?php
function facebook_like(){
function getAddress() //this function will show the URL you are on DONT EDIT
{
/*** check for https ***/
$protocol = $_SERVER['HTTPS'] == 'on' ? 'https' : 'http';
/*** return the full address ***/
return $protocol.'://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
}
$url =  getAddress(); //your full URL for page
return '<iframe src="http://www.facebook.com/plugins/like.php?href='.$url.'&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>';
}
?>
<h1>Hey do you like this page PHPacademy?</h1>
<?=facebook_like();?>

ليست هناك تعليقات:

إرسال تعليق