ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
Structures_BibTex_example.php
Go to the documentation of this file.
1<?php
2error_reporting(E_ALL);
3require_once 'PEAR.php';
4require_once 'Structures/BibTex.php';
6//Loading and parsing the file example.bib
7$ret = $bibtex->loadFile('example.bib');
9 print $ret->getMessage();
10 die();
11}
12$bibtex->parse();
13//Creating an entry
14$addarray = array();
15$addarray['entryType'] = 'Article';
16$addarray['cite'] = 'art2';
17$addarray['title'] = 'Titel2';
18$addarray['author'][0]['first'] = 'John';
19$addarray['author'][0]['last'] = 'Doe';
20$addarray['author'][1]['first'] = 'Jane';
21$addarray['author'][1]['last'] = 'Doe';
22//Adding the entry
23$bibtex->addEntry($addarray);
24//Printing the result
25echo "Converting This Array:\n\n";
26echo "<pre>";
27print_r($bibtex->data);
28echo "\nInto this:\n\n";
29echo $bibtex->bibTex();
30echo "<hr />";
31echo "\nAnd here is the RTF String:\n\n";
32echo $bibtex->rtf();
33echo "<hr />";
34echo "\nAnd here are the data in HTML:\n\n";
35echo $bibtex->html();
36echo "<hr />";
37echo "\nAnd here is the statistic:\n\n";
38print_r($bibtex->getStatistic());
39echo "</pre>";
40?>
isError($data, $code=null)
Tell whether a value is a PEAR error.
Definition: PEAR.php:279
if(! $in) print