<!DOCTYPE html> <?php require_once './config.php'; //library credentials require_once '../build/libZoteroSingle.php'; $library = new Zotero_Library($libraryType, $libraryID, $librarySlug, $apiKey); $library->setCacheTtl(90); //load a couple items with multiple content types $items = $library->fetchItemsTop(array('limit' => 10, 'content' => 'bib,citation,coins', 'linkwrap' => 1, 'style' => 'chicago-fullnote-bibliography')); ?> <html> <head> <title>Multi-Content</title> <meta charset="utf-8"> </head> <body> <h2>Bib-Content</h2> <?foreach($items as $item):?> <? $doc = new DOMDocument(); $doc->loadXml($item->bibContent); $linkNodes = $doc->getElementsByTagName("a"); foreach($linkNodes as $node){ $node->nodeValue = "Link"; } $newBibContent = $doc->saveXML(); ?> <p><?php echo $newBibContent; ?> </p>
<?php //library credentials require_once './config.php'; //load the zotero php library require_once '../build/libZoteroSingle.php'; //create a library object to interact with the zotero API $library = new Zotero_Library($libraryType, $libraryID, $userSlug, $apiKey); //use Alternative PHP Cache to save API responses for 30 minutes //this will cache unique api responses so we get faster responses //and don't get rate-limited by the API for making too many requests $library->setCacheTtl(1800); //parameters we'll pass when retrieving items to order by item titles $feedParams = array('order' => 'title'); //restrict the total items we'll fetch to 200 $totalItemLimit = 200; //start at the beginning of our list by setting an offset of 0 $offset = 0; //limit to 100 items per http request //this is the maximum number of items the API will return in a single request $perRequestLimit = 100; //keep count of the items we've gotten $fetchedItemsCount = 0; //keep track of whether there are more items to fetch $moreItems = true; //where we'll keep the list of items we retrieve $items = array(); //while there are more items and we haven't gotten to our limit yet while ($fetchedItemsCount < $totalItemLimit && $moreItems) { echo "fetching items starting at {$offset} with {$perRequestLimit} items per request <br />"; //fetching items starting at $offset with $perRequestLimit items per request
<!DOCTYPE html> <?php require_once './config.php'; //library credentials require_once '../../build/libZoteroSingle.php'; $library = new Zotero_Library($libraryType, $libraryID, $librarySlug, $apiKey); $library->setCacheTtl(300); //load a couple items with multiple content types $items = $library->fetchItems(array('content' => 'bib,coins', 'linkwrap' => 1, 'style' => 'chicago-fullnote-bibliography', 'collectionKey' => $collectionKey)); ?> <html> <head> <title>Publications</title> <meta charset="utf-8"> </head> <body> <h2>Publications</h2> <?php foreach ($items as $item) { ?> <p><?php echo $item->bibContent; ?> <a href="./download.php?itemkey=<?php echo $item->itemKey; ?> ">Download</a></p> <?php echo htmlspecialchars_decode($item->subContents['coins']); ?> <?php