Example #1
0
<body>

<? if ($collection = $_GET['collection']): ?>

<?
$docs = $mendeley->http('library/collections/' . urlencode($collection));

$items = array();
foreach ($docs['document_ids'] as $id){
  $doc = $mendeley->http('library/documents/' . $id);
  if (!$doc['notes']) continue;
  $doc['id'] = $id;
  $items[] = $doc;
}

$citations = $mendeley->cite($items, 'nlm');
preg_match_all('!<div class="csl-right-inline">(.+?)</div>!s', $citations, $matches);
?>

<h1>DocNotes</h1>
<ol id="notes">
<? foreach ($items as $key => $doc): ?>
  <li class="item" id="doc-<? h($doc['id']); ?>">
    <div class="citation"><?php 
echo $matches[1][$key];
?>
</div>
    <div class="notes"><? h($doc['notes']); ?></div>
  </li>
<? endforeach; ?>
</ol>