Skip to content

Instantly share code, notes, and snippets.

@davidsword
Last active February 3, 2018 03:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidsword/6920a66855e522da8f3af3d00a671406 to your computer and use it in GitHub Desktop.
Save davidsword/6920a66855e522da8f3af3d00a671406 to your computer and use it in GitHub Desktop.
<?
// read cache and convert XML to ARRAY
$data_cache = explode($breaker,file_get_contents($cache));
$reading = new SimpleXMLElement($data_cache[0]);
$read = new SimpleXMLElement($data_cache[1]);
echo "<div id='bookshelf'>";
// cycle through currently reading (@TODO i dont know if cycle works nativily, only developed with 1 book in shelf. sometimes they change the xml structure when >1. would need to change)
foreach ($reading->reviews->review as $reading)
echo "<div>book->title}' class='book reading' style='background-image:url(".str_replace('http:', 'https:', $reading->book->image_url).");'></div>";
// cycle through read
$c = 1;
foreach ($read->reviews->review as $read) {
$img = @(isset($image_fix['id_'.$read->book->id])) ? $image_fix['id_'.$read->book->id] : $read->book->image_url;
if ($c < 4)
echo "<div>book->title} - #{$read->book->id}' class='book read' style='background-image:url(".str_replace('http:', 'https:', $img).");'></div>";
$c++;
}
echo "</div><!--/bookshelf-->";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment