Появилась необходимость изменить стандартный виджет Вконтакте для отображения блока сообществ, а именно вытянуть его по ширине и выводить тока иконки и имена юзеров.
PHP Код
if (!$soc_result)
{
// 1. инициализация
$ch = curl_init();
// 2. указываем параметры, включая url
curl_setopt($ch, CURLOPT_URL, "http://vk.com/widget_community.php?app=0000000&width=1000px&gid=0000000&mode=0&color1=FFFFFF&color2=000000&color3=939393&clear=none&height=2000&url=http%3A%2F%2Fdomain.ru%2F");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
// 3. получаем HTML в качестве результата
$outputt = curl_exec($ch);
// 4. закрываем соединение
curl_close($ch);
$outputt = iconv('windows-1251', 'utf-8' , $outputt);
$outputt = str_replace("</div></div><div class=\"clear\"></div>", "", $outputt);
preg_match_all("|class=\"community_square_user\">(.*?)</div><div |is", $outputt, $regs_picks);
$i=0;
foreach ($regs_picks[1] as $key => $value) {
$i++;
if (($i > 3) && ($i<64)) {
$soc_result .= "<div class=\"community_square_user\">".$value."</div>";
}
}
sed_cache_store('soc_result',$soc_result,3600);
}
$t-> assign(array(
"PLUGIN_MAG_SOCIAL" => $soc_result
));
"<div class=\"community_square_user\">".$value."</div>";
}
}
sed_cache_store('soc_result',$soc_result,3600);
}
$t-> assign(array(
"PLUGIN_MAG_SOCIAL" => $soc_result
));CSS
.community_square_user {
width: 50px;
height: 68px;
float: left;
overflow: hidden;
text-align: center;
}
.community_square_user a {
font-size: 0.8em;
font-family: tahoma, verdana, arial, sans-serif, Lucida Sans;
color:#010101;
}
.community_square_user a:hover {
text-decoration: none; !important;
}
.community_square_pic {
height: 45px;
clear: both;
overflow: hidden;
padding-bottom: 3px;
}
.community_square_pic img {
width:45px;
height:45px;
}Ссылка вида:
http://vk.com/widget_community.php?app=0000000&width=1000px&gid=51778495&mode=0&color1=FFFFFF&color2=000000&color3=939393&clear=none&height=2000&url=http%3A%2F%2Fdomain.ru%2F
Где app=0000000 это ID важего приложения
gid=0000000 это ID группы
url — это реферер