Skip to content

Commit

Permalink
Updated the examples to be friendly, both with UI and simplicity
Browse files Browse the repository at this point in the history
  • Loading branch information
zachdunn committed Oct 20, 2010
1 parent 1e206e9 commit 09cb783
Show file tree
Hide file tree
Showing 8 changed files with 300 additions and 97 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# list of ignored files
.DS_Store
49 changes: 0 additions & 49 deletions comments.php

This file was deleted.

72 changes: 72 additions & 0 deletions examples/comments.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php

require_once('../src/dribbble.php');

$dribbble = new Dribbble();

# find a shot
$shot = $dribbble->shot->find(62170);

# Get first 5 comments on first page
$comments = $shot->comments(array('page' => 1, 'per_page' => 5));

?>
<!DOCTYPE html>
<html>

<head>
<title>Comment Examples | Dribbble PHP</title>
<link rel="stylesheet" href="css/style.css" />

</head>

<body>

<header>
<h1>dribbble API (PHP) / <span>Comments</span></h1>
</header>

<section>

<h1>Original Shot</h1>

<ul class="shots">
<li>
<h2><a href="<?php echo $shot->url;?>"><?php echo $shot->title; ?></a></h2>
<a href="<?php echo $shot->url;?>"><img src="<?php echo $shot->image_url; ?>" alt="<?php echo $shot->title; ?>"/></a>
<p>from <a href="<?php echo $shot->player->url; ?>"><?php echo $shot->player->name; ?></a>
</li>
</ul>

</section>

<section>
<h1>Comments</h1>
<?php if ($comments) : ?>

<ul class="comments">

<?php foreach ($comments as $comment) { ?>

<li>
<p><span class="author"><a href="<?php echo $comment->player->url; ?>"><?php echo $comment->player->name; ?></a> says:</span> <?php echo $comment->body; ?></p>
</li>

<?php } ?>

</ul>

<?php else : ?>

<p>No comments on this shot yet</p>

<?php endif; ?>
</section>

<footer>
<p>This page uses the <a href="http://github.com/martinbean/dribbble-php" title="Dribbble PHP Wrapper on GitHub" target="_blank">Dribbble PHP Wrapper</a> built for <a href="http://dribbble.com/api">Dribbble's API</a>.</p>
</footer>

</body>

</html>
47 changes: 47 additions & 0 deletions examples/css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
General Styles
Dribbble API PHP Wrapper
Use Examples
Git: http://github.com/martinbean/dribbble-php
This is strictly presentaional, and has no impact
on the PHP wrapper itself. Rewrite & delete away!
*/

/*
Dribbble Palette
----------------
Pink #ea4c89
Graphite #434950
Green #8aba56
*/

body{background:#efefef; margin:0; padding:0; -webkit-font-smoothing:antialiased;}

img{border:none;}

ul.shots, ul.comments{list-style:none; margin:0; padding:0;}

ul.shots li, ul.comments li{float:left; display:inline; margin:0 15px 15px 0;}
.shots img{background:#FFF; padding:20px; border:1px solid #DDD;}

ul.shots li p{text-align:center;}

ul.comments li {background:#fff; border-radius:3px; -webkit-border-radius:3px; border:1px solid #DDD; padding:0 12px;}
span.author{text-transform:uppercase; color:#9b9b9b; font-size:11px; letter-spacing:1px;}
/*
Layout (Uses HTML5)
*/
header{background:#8aba56; display:block; clear:both; padding:15px;}
section{clear:both; display:block; padding:0 0 0 30px; overflow:hidden;}
footer{clear:both; display:block; }
/*
Typography
*/
a{color:#ea4c89}
h1{font:28px/16px "Helvetica Neue", Helvetica, Arial, sans-serif; font-weight:bold; color:#434950; margin-top:30px;}
header h1{font-size:12px; color:#6c9c38; margin:0; font-weight:bold; letter-spacing:2px; text-transform:uppercase;}
header h1 span{color:#FFF;}
h2{font:21px/16px "Helvetica Neue", Helvetica, Arial, sans-serif; font-weight:bold;}
p{font:14px/1.6em "Helvetica Neue", Helvetica, Arial, sans-serif; color:#333;}
footer p{text-align:center; color:#9b9b9b; border-top:1px dashed #CCC; padding:15px 0 30px 0; margin-bottom:0;}
103 changes: 103 additions & 0 deletions examples/general.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<?php

require_once('../src/dribbble.php');

$dribbble = new Dribbble();

?>

<!DOCTYPE html>
<html>

<head>
<title>Preset Feeds | Dribbble PHP</title>
<link rel="stylesheet" href="css/style.css" />

</head>

<body>

<header>
<h1>dribbble API (PHP) / <span>Preset Feeds</span></h1>
</header>

<section>

<h1>Popular Shots</h1>

<ul class="shots">

<?php

//If we're using the same dribbble object, this will overwrite previous calls
$popular_shots = $dribbble->shot->popular(array('page' => 1, 'per_page' => 3));
foreach ($popular_shots->shots as $shot) { ?>

<li>
<h2><a href="<?php echo $shot->url;?>"><?php echo $shot->title; ?></a></h2>
<a href="<?php echo $shot->url;?>"><img src="<?php echo $shot->image_url; ?>" alt="<?php echo $shot->title; ?>"/></a>
<p>from <a href="<?php echo $shot->player->url; ?>"><?php echo $shot->player->name; ?></a>
</li>

<?php } ?>

</ul>

</section>

<section>

<h1>Everyone Shots</h1>

<ul class="shots">

<?php

//If we're using the same dribbble object, this will overwrite previous calls
$everyone_shots = $dribbble->shot->everyone(array('page' => 1, 'per_page' => 3));

foreach ($everyone_shots->shots as $shot) { ?>

<li>
<h2><a href="<?php echo $shot->url;?>"><?php echo $shot->title; ?></a></h2>
<a href="<?php echo $shot->url;?>"><img src="<?php echo $shot->image_url; ?>" alt="<?php echo $shot->title; ?>"/></a>
<p>from <a href="<?php echo $shot->player->url; ?>"><?php echo $shot->player->name; ?></a>
</li>

<?php } ?>

</ul>

</section>

<section>

<h1>Debut Shots</h1>

<ul class="shots">

<?php

//If we're using the same dribbble object, this will overwrite previous calls
$debut_shots = $dribbble->shot->debuts(array('page' => 1, 'per_page' => 3));
foreach ($debut_shots->shots as $shot) { ?>

<li>
<h2><a href="<?php echo $shot->url;?>"><?php echo $shot->title; ?></a></h2>
<a href="<?php echo $shot->url;?>"><img src="<?php echo $shot->image_url; ?>" alt="<?php echo $shot->title; ?>"/></a>
<p>from <a href="<?php echo $shot->player->url; ?>"><?php echo $shot->player->name; ?></a>
</li>

<?php } ?>

</ul>

</section>

<footer>
<p>This page uses the <a href="http://github.com/martinbean/dribbble-php" title="Dribbble PHP Wrapper on GitHub" target="_blank">Dribbble PHP Wrapper</a> built for <a href="http://dribbble.com/api">Dribbble's API</a>.</p>
</footer>

</body>

</html>
2 changes: 1 addition & 1 deletion examples.php → examples/raw/examples.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//error_reporting(E_ALL);
//ini_set("display_errors", 1);

require_once('src/dribbble.php');
require_once('../src/dribbble.php');

$dribbble = new Dribbble();

Expand Down
75 changes: 75 additions & 0 deletions examples/rebounds.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?php

require_once('../src/dribbble.php');

$dribbble = new Dribbble();

# find a shot (must come before comments/rebounds call
$shot = $dribbble->shot->find(65147);

# Get rebounds
$rebounds = $shot->rebounds(array('per_page' => 4));

?>
<!DOCTYPE html>
<html>

<head>
<title>Rebound Examples | Dribbble PHP</title>
<link rel="stylesheet" href="css/style.css" />

</head>

<body>

<header>
<h1>Dribbble API (PHP) / <span>Rebounds</span></h1>
</header>

<section>

<h1>Original Shot</h1>

<ul class="shots">
<li>
<h2><a href="<?php echo $shot->url;?>"><?php echo $shot->title; ?></a></h2>
<a href="<?php echo $shot->url;?>"><img src="<?php echo $shot->image_url; ?>" alt="<?php echo $shot->title; ?>"/></a>
<p>from <a href="<?php echo $shot->player->url; ?>"><?php echo $shot->player->name; ?></a>
</li>
</ul>

</section>

<section>
<h1>Rebounds</h1>
<?php if ($rebounds) : ?>

<ul class="shots">

<?php foreach ($rebounds as $rebound) { ?>

<li>
<h2><a href="<?php echo $rebound->url;?>"><?php echo $rebound->title; ?></a></h2>
<a href="<?php echo $rebound->url;?>"><img src="<?php echo $rebound->image_url; ?>" alt="<?php echo $rebound->title; ?>"/></a>
<p>from <a href="<?php echo $rebound->player->url; ?>"><?php echo $rebound->player->name; ?></a>
</li>

<?php } ?>

</ul>

<?php else : ?>

<p>No rebounds on this shot yet</p>

<?php endif; ?>
</section>

<footer>
<p>This page uses the <a href="http://github.com/martinbean/dribbble-php" title="Dribbble PHP Wrapper on GitHub" target="_blank">Dribbble PHP Wrapper</a> built for <a href="http://dribbble.com/api">Dribbble's API</a>.</p>
</footer>

</body>

</html>

Loading

0 comments on commit 09cb783

Please sign in to comment.