Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

131 lines (106 sloc) 4.665 kb
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns="" xml:lang="en" lang="en">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Multi-Level Backbone Image Gallery</title>
<link rel="stylesheet" href="gallery.css" type="text/css" media="screen" charset="utf-8" />
<link rel="stylesheet" href="shadows.css" type="text/css" media="screen" charset="utf-8" />
<link rel="stylesheet" href="buttons.css" type="text/css" media="screen" charset="utf-8" />
<script id="indexTmpl" type="text/x-jquery-tmpl">
<div class="item drop-shadow round">
<div class="item-image">
<a href="#subalbum/${cid}"><img src="${attributes.image}" alt="${attributes.title}" /></a>
<div class="item-artist">${attributes.artist}</div>
<div class="item-title">${attributes.title}</div>
<div class="item-years">${attributes.years}</div>
<script id="subindexTmpl" type="text/x-jquery-tmpl">
<div class="item drop-shadow round">
<div class="item-image subalbum">
<a href="#subalbum/${subalbum}/${}"><img src="${attributes.image}" alt="${attributes.title}" alt="No images in this folder"/></a>
<div class="item-artist">${attributes.artist}</div>
<div class="item-title">${attributes.title}</div>
<div class="item-price">$${attributes.price}</div>
<script id="itemTmpl" type="text/x-jquery-tmpl">
<div class="item-detail">
<div class="item-image drop-shadow round"><img src="${attributes.large_image}" alt="${attributes.title}" /></div>
<div class="item-info">
<div class="item-artist">${attributes.artist}</div>
<div class="item-title">${attributes.title}</div>
<div class="item-price">$${attributes.price}</div>
<br />
<div class="item-link"><a href="${attributes.url}" class="button">Buy this item</a></div>
<div class="back-link"><a href="#" class="button">&laquo; Back to Albums</a></div>
<div id="container">
<div id="header">
<a href="index.php">Multi-Level Backbone Gallery</a>
<h3>Created by Addy Osmani for 'Building Single-page Apps With jQuery's Best Friends'</h3>
<div id="main">
<div class="jstest">This application is running with JavaScript turned off.</div>
<script src="LAB.min.js" type="text/javascript"></script>
//PHP fallback to enable graceful degredation
//feel free to substitute with a more secure read-in method
$json = file_get_contents("data/album1.json");
$folderType = $_GET['view'];
$index = $_GET['ind'];
$subal = $_GET['subalbum'];
$subalbums = array();
$i =0; $j =0;
//expose convenient access to subalbums
foreach ($json_a as $p => $k){
foreach($k["subalbum"] as $sub){
$subalbums[$i][$j] = $sub;
//handle 'view' switching
case "subalbum":
echo "<ul class='gallery'>";
foreach($subalbums[$index] as $sub){
echo "<li class='item drop-shadow round'><a href='" . $sub['large_image'] . "'><img src='" . $sub['image'] . "'></img>" . $sub['title'] . "</a> " . $sub['artist'] ." </li>";
echo "</ul>";
$ind = 0;
echo "<ul class='gallery'>";
foreach($json_a as $p => $k){
echo "<li class='item drop-shadow round'><a href='index.php?view=subalbum&ind=$ind'><img src='" . $k['image'] . "'></img>" . $k['title'] . "</a> " . $k['years'] ." </li>";
echo "</ul>";
<script type="text/javascript">
Jump to Line
Something went wrong with that request. Please try again.