Structures_BibTex
[ class tree: Structures_BibTex ] [ index: Structures_BibTex ] [ all elements ]

Source for file Structures_BibTex_example.php

Documentation is available at Structures_BibTex_example.php

  1. <?php
  2.  
  3. require_once 'PEAR.php';
  4. require_once 'Structures/BibTex.php';
  5.  
  6. $bibtex = new Structures_BibTex();
  7.  
  8. //Loading and parsing the file example.bib
  9. $ret=$bibtex->loadFile('example.bib');
  10. if(PEAR::isError($ret)) {
  11.     print $ret->getMessage();
  12.     die();
  13. }
  14. $bibtex->parse();
  15.  
  16. //Creating an entry
  17. $addarray = array();
  18. $addarray['entryType']          'Article';
  19. $addarray['cite']               'art2';
  20. $addarray['title']              'Titel2';
  21. $addarray['author'][0]['first''John';
  22. $addarray['author'][0]['last']  'Doe';
  23. $addarray['author'][1]['first''Jane';
  24. $addarray['author'][1]['last']  'Doe';
  25. //Adding the entry
  26. $bibtex->addEntry($addarray);
  27.  
  28. //Printing the result
  29. echo "Converting This Array:\n\n";
  30. echo "<pre>";
  31. print_r($bibtex->data);
  32. echo "\nInto this:\n\n";
  33. echo $bibtex->bibTex();
  34. echo "<hr />";
  35. echo "\nAnd here is the RTF String:\n\n";
  36. echo $bibtex->rtf();
  37. echo "<hr />";
  38. echo "\nAnd here are the data in  HTML:\n\n";
  39. echo $bibtex->html();
  40. echo "<hr />";
  41. echo "\nAnd here is the statistic:\n\n";
  42. print_r($bibtex->getStatistic());
  43. echo "</pre>";
  44. ?>

Documentation generated on Mon, 11 Mar 2019 15:47:12 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.