Problem w tym ze nie wiem w jaki sposób sprawdzić czy przycisk "lubie to" był klikniety, do stworzenia warunku o którym piszesz jest potrzebna jakaś zmiena typu "true" gdy klikną itd.
Witam ponownie,
Znalazłem chyba rozwiązanie ale nie wiem jak ponazywać pliki i jak je połączyć.
Wiem że irytujące i pewnie banalnie proste, ale nigdy nie maiałem do czynienia z javascript i nie wiem.
podam teraz kody poszczególnych plików:
plik1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <link rel="stylesheet" type="text/css" href="style.css" /> body {
width:520px;
margin:0; padding:0; border:0;
font-family: verdana;
background:url(repeat.png) repeat;
margin-bottom:10px;
}
p, h1 {width:450px; margin-left:50px; color:#FFF;}
p {font-size:11px;}
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<img src="welcome.png" alt="Frontimg">
plik2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <link rel="stylesheet" type="text/css" href="style.css" /> body {
width:520px;
margin:0; padding:0; border:0;
font-family: verdana;
background:url(repeat.png) repeat;
margin-bottom:10px;
}
p, h1 {width:450px; margin-left:50px; color:#FFF;}
p {font-size:11px;}
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<img src="member.png" alt="Frontimg"> <p>You liked this page
</p>
plik3
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({
appId : '296633137066777', //id aplikacji
status : true,
cookie : true,
xfbml : true
});
</script>
<div id="container_notlike">
YOU DONT LIKE
</div>
<div id="container_like">
YOU LIKE
</div>
plik4
body {
width:520px;
margin:0; padding:0; border:0;
font-family: verdana;
background:url(repeat.png) repeat;
margin-bottom:10px;
}
p, h1 {width:450px; margin-left:50px; color:#FFF;}
p {font-size:11px;}
#container_notlike, #container_like {
display:none
}
plik5
$(document).ready(function(){
FB.login(function(response) {
if (response.session) {
var user_id = response.session.uid;
var page_id = "255811621159995"; //coca cola
var fql_query = "SELECT uid FROM page_fan WHERE page_id = "+page_id+"and uid="+user_id;
var the_query = FB.Data.query(fql_query);
the_query.wait(function(rows) {
if (rows.length == 1 && rows[0].uid == user_id) {
$("#container_like").show();
//here you could also do some ajax and get the content for a "liker" instead of simply showing a hidden div in the page.
} else {
$("#container_notlike").show();
//and here you could get the content for a non liker in ajax...
}
});
} else {
// user is not logged in
}
});
});
Przepraszam że tak dużo kodu..