本文介绍了在 PHP 中使用 Dribbble API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用 Dribbble API 将我的 dribbble 镜头介绍我的投资组合网站.我不是 PHP 人,所以我不知道如何使用 API (http://dribbble.com/api).
I want to get my dribbble shots intro my portfolio website using the Dribbble API. I'm not a PHP guy, that's why I don't know how to use the API (http://dribbble.com/api).
如何在我的 HTML 或 PHP 页面中获取照片?
How can I get shots into my HTML or PHP page ?
问候,请原谅我的无能.
Regards and please excuse my inaptitude.
干杯!
推荐答案
使用此 JS 并将用户信息更改为您的姓名
use this JS and change the user info to your name
// variables used
var slgoetzShots;
var slgoetzNum = 1;
var active = "Slgoetz";
// slgoetz shots
function slgoetzGet(pageNum){
var url = "http://api.dribbble.com/slgoetz/shots";
$.get(
url, {page:pageNum, per_page:"30"},
function(data){
slgoetzShots = data;
slgoetzNum += 1;
render(slgoetzShots);
},
"jsonp"
);
};
// slgoetzGet: render
function getSimon(){
if (active != "slgoetz"){
slgoetzGet("1");
$('#'+active).removeClass("active");
$('#Everyone').addClass("active");
active = "Simon Goetz";
slgoetzNum = 1;
};
};
//popular shots is default
getSimon("1")
var inner = "";
var innerP1 = '<li><div class="dribbble"><div class="shot"><a href="';
var innerP2 = '"><img src="';
var innerP3 = '"></a></div><div class="likes">'
var innerP4 = ' Likes</div><div class="comments">'
var innerP5 = ' Comments</div><div class="name">'
var innerp6 = '</div></div></li>'
function render(filter){
for (var i = 0; i<filter.shots.length;i++){
inner = inner + innerP1 + filter.shots[i].url + innerP2 + filter.shots[i].image_url + innerP3 + filter.shots[i].likes_count + innerP4 + filter.shots[i].comments_count + innerP5 + filter.shots[i].title + innerp6;
};
$('.gallery').html(inner);
inner = "";
};
function loadMore(){
switch(active){
case "Simon Goetz":
inner = $('.gallery').html();
slgoetzGet(slgoetzNum.toString());
break;
};
};
HTML 将 .gallery 类添加到 div
HTML add a .gallery class to a div
这篇关于在 PHP 中使用 Dribbble API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!