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

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