Permalink
Browse files

Updated the examples to be friendly, both with UI and simplicity

  • Loading branch information...
1 parent 1e206e9 commit 09cb783922eac7375b4b1a169952f157bdea67a6 @zachdunn zachdunn committed Oct 20, 2010
Showing with 300 additions and 97 deletions.
  1. +2 −0 .gitignore
  2. +0 −49 comments.php
  3. +72 −0 examples/comments.php
  4. +47 −0 examples/css/style.css
  5. +103 −0 examples/general.php
  6. +1 −1 { → examples/raw}/examples.php
  7. +75 −0 examples/rebounds.php
  8. +0 −47 rebounds.php
View
2 .gitignore
@@ -0,0 +1,2 @@
+# list of ignored files
+.DS_Store
View
49 comments.php
@@ -1,49 +0,0 @@
-<?php
-/**
- * Examples for using the Dribbble API PHP wrapper
- * An expansion of the wrapper that includes start of comments
- *
- * @author Martin Bean <martin@mcbwebdesign.co.uk>
- * Edits by Zach Dunn (onemightyroar.com)
- */
-
-error_reporting(E_ALL);
-ini_set("display_errors", 1);
-
-require_once('src/dribbble.php');
-
-echo "<h1>Dribbble w/ Comments</h1>";
-$dribbble = new Dribbble();
-
-# find a shot
-$shot = $dribbble->shot->find(62170);
-
-# Alternate Direct call to comments
-# $comments = $dribbble->shot->find(21690)->comments(array('per_page' => 2));
-
-# Get comments
-$comments = $shot->comments(array('per_page' => 4));
-
-if ($comments) :
-
- echo "<ol>";
-
- foreach ($comments as $comment) { ?>
-
- <li><?php echo $comment->body; ?> from <a href="<?php echo $comment->player->url; ?>"><?php echo $comment->player->name; ?></a></li>
-
- <?php }
-
- echo "</ol>";
-
-else :
-
- echo "No Comments";
-
-endif;
-
-#echo '<pre>';
-# var_dump($shot->comments());
-#echo '</pre>';
-
-?>
View
72 examples/comments.php
@@ -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>
View
47 examples/css/style.css
@@ -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;}
View
103 examples/general.php
@@ -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>
View
2 examples.php → examples/raw/examples.php
@@ -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();
View
75 examples/rebounds.php
@@ -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>
+
View
47 rebounds.php
@@ -1,47 +0,0 @@
-<?php
-/**
- * Examples for using the Dribbble API PHP wrapper
- * An expansion of the wrapper that includes start of comments
- *
- * @author Martin Bean <martin@mcbwebdesign.co.uk>
- * Edits by Zach Dunn (onemightyroar.com)
- */
-
-error_reporting(E_ALL);
-ini_set("display_errors", 1);
-
-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));
-
-echo "<h1>Rebounds of " . $shot->title . " (#" . $shot->id . ")</h1>";
-
-if ($rebounds) :
-
- echo "<ol>";
-
- foreach ($rebounds as $rebound) { ?>
-
- <li>
- <h2><a href="<?php echo $rebound->url;?>"><?php echo $rebound->title; ?></a></h2>
- <img src="<?php echo $rebound->image_url; ?>" alt="<?php echo $rebound->title; ?>"/>
- <p>from <a href="<?php echo $rebound->player->url; ?>"><?php echo $rebound->player->name; ?></a>
- </li>
-
- <?php }
-
- echo "</ol>";
-
-else :
-
- echo "No Rebounds";
-
-endif;
-
-?>

0 comments on commit 09cb783

Please sign in to comment.