Structures_BibTex
A class which provides common methods to access and create Strings in BibTex format. Example 1: Parsing a BibTex File and returning the number of entries
Example 2: Parsing a BibTex File and getting all Titles
- $bibtex = new Structures_BibTex();
- $ret = $bibtex->loadFile('foo.bib');
- if (PEAR::isError($ret)) {
- die($ret->getMessage());
- }
- $bibtex->parse();
- print "There are ".$bibtex->amount()." entries";
Example 3: Adding an entry and printing it in BibTex Format
- $bibtex = new Structures_BibTex();
- $ret = $bibtex->loadFile('bibtex.bib');
- if (PEAR::isError($ret)) {
- die($ret->getMessage());
- }
- $bibtex->parse();
- foreach ($bibtex->data as $entry) {
- print $entry['title']."<br />";
- }
- $bibtex = new Structures_BibTex();
- $addarray = array();
- $addarray['type'] = 'Article';
- $addarray['cite'] = 'art2';
- $addarray['title'] = 'Titel2';
- $addarray['author'][0] = 'John Doe';
- $addarray['author'][1] = 'Jane Doe';
- $bibtex->addEntry($addarray);
- print nl2br($bibtex->bibTex());
Located in /BibTex.php (line 75)
Constructor
Adds a new BibTex entry to the data
Returns the amount of available BibTex entries
Converts the stored BibTex entries to a BibTex String
In the field list, the author is the last field.
Cleares all warnings
Returns statistic
This functions returns a hash table. The keys are the different entry types and the values are the amount of these entries.
Is there a warning?
Returns the stored data in HTML format
This method simply returns a HTML formatted string. This is done very simple and is not intended for heavy using and fine formatting. This should be done by BibTex! It is intended to give some kind of quick preview. If you want to change the default format you have to override the class variable "htmlstring". This variable is used and the placeholders simply replaced. Lines with no data cause an warning!
Reads a give BibTex File
Parses what is stored in content and clears the content if the parsing is successfull.
Returns the stored data in RTF format
This method simply returns a RTF formatted string. This is done very simple and is not intended for heavy using and fine formatting. This should be done by BibTex! It is intended to give some kind of quick preview or to send someone a reference list as word/rtf format (even some people in the scientific field still use word). If you want to change the default format you have to override the class variable "rtfstring". This variable is used and the placeholders simply replaced. Lines with no data cause an warning!
Sets run-time configuration options
Documentation generated on Fri, 28 Jul 2006 20:01:02 +0200 by phpDocumentor 1.3.0RC5