Forked from JeffreyWay/Envato Marketplaces: Display Recent Items - index.php
Created
July 17, 2014 08:02
-
-
Save WordpressDev/a1f7b381fc46f9207143 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class envato_marketplace { | |
public static $base_url = 'http://marketplace.envato.com/api/edge/'; | |
public function curl($path) { | |
$ch = curl_init(self::$base_url . $path); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
$data = curl_exec($ch); | |
curl_close($ch); | |
return json_decode($data); | |
} | |
} | |
$data = envato_marketplace::curl('new-files-from-user:JeffreyWay,tutorials.json'); | |
$data = $data->{'new-files-from-user'}; | |
include 'index.tmpl.php'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>untitled</title> | |
</head> | |
<body> | |
<?php foreach($data as $item) : ?> | |
<h2> | |
<a href="<?php echo $item->url; ?>"> | |
<?php echo $item->item; ?> | |
</a> | |
<span> <?php echo $item->sales; ?> </span> | |
</h2> | |
<img src="<?php echo $item->live_preview_url;?>" alt="<?php echo $item->item; ?>" /> | |
<?php endforeach; ?> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment