<head>
...
<script type="text/javascript" src="//vk.com/js/api/openapi.js?113"></script>
<script type="text/javascript">
VK.init({apiId: ваш_appId, onlyWidgets: true});
</script>
</head>
<body>
...
<div id="vk_like"></div>
<script type="text/javascript">
VK.Widgets.Like("vk_like", {type: "button"});
VK.Observer.subscribe("widgets.like.shared", function f() {
alert('Молодец!');
});
</script>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 445457008923933,
status : true,
xfbml : false
});
};
function popup(){
FB.ui(
{
method: 'feed',
name: 'name - Тестим',
caption: 'Какой-то caption',
description: 'ДАДАДАДАДАДААДАДДА',
link: 'https://developers.facebook.com/docs/reference/javascript/'
},
function(response) {
if (response && response.post_id) {
alert('Молодец!');
} else {
alert('плохо =(');
}
}
);
}
</script>
<style type="text/css">
body,html {
position: relative;
height: 100%;
width: 100%;
}
.fb-like {
position: absolute;
margin: auto;
left: 0;
top: 0;
bottom: 0;
right: 0;
height: 400px;
width: 400px;
background: red;
color: white;
font-size: 30px;
cursor: pointer;
}
</style>
<script>
(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/ru_RU/all/debug.js";
// uncomment on production
// js.src = "//connect.facebook.net/ru_RU/all.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<div class="fb-like" onclick="popup()"> Нажми и расшарь!</div>
<?
$rewrite['/'] = 'Новый тайтл';
$rewrite['/about/'] = 'Новый тайтл';
ob_start("titler");
function titler($content) {
global $rewrite;
if (isset($rewrite[$_SERVER['REQUEST_URI']]))
return preg_replace("#<title>.*?</title>#",'<title>' . $rewrite[$_SERVER['REQUEST_URI']] . '</title>');
else return $content;
}
php_value auto_prepend_file "titler.php";