Jump to content
Wiki Home
EPrints Home
Bazaar
Files
Main menu
Main menu
move to sidebar
hide
Navigation
Front Page
EPrints 3 Manual
EPrints Training Course
EPrints Glossary
Installing EPrints
How-to Configure EPrints
EPrints 3.2+ API
EPrints 3 Reference
EPrints Plugins
Wiki
All categories
Recent changes
Main Page
Help
EPrints Documentation
Search
Search
Appearance
Log in
Request account
Personal tools
Log in
Request account
Pages for logged out editors
learn more
Contributions
Talk
Editing
Repository configuration
(section)
Page
Discussion
British English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===EPrints API functions which return XHTML objects.=== Note, all text strings should be in UTF-8. Example: <code> my $page = $session->make_doc_fragment(); my $h1 = $session->make_element( "h1" ); $h1->appendChild( $session->make_text( "Title" ) ); $page->appendChild( $h1 ); $page->appendChild( $session->make_element( "img", src=>"/images/cheese.gif", width=>128, height=>53 ) ); </code> $page now contains: <code><nowiki> <h1>Title</h1><img src="/images/cheese.gif" width="128" height="53" /> </nowiki></code> Many of the EPrints modules are fully documented. For an example try running: <code> % perldoc /opt/eprints2/perl_lib/EPrints/Archive.pm </code> The functions most useful to extacting and rendering information are documented here: ; <tt> $session->make_text( $text ) </tt> : Returns a DOM object representing that text. ; <tt> $session->make_doc_fragment() </tt> : Returns a document fragment. This renders to nothing but is a container to which you can add stuff. ; <tt> $session->make_element( $name, %opts ) </tt> : Makes a simple XHTML element. %opts is an optional series of attributes. To make <code><nowiki><h1 class="foo">...</h1> </nowiki></code> you would call: <code> $session->make_element( "h1", class=>"foo" ); </code> ; <tt> $session->render_ruler(); </tt> : Returns the default ruler for the archive (from ruler.xml). ; <tt> $session->render_link( $uri, $target ) </tt> : Returns the XHTML element (with URI properly escaped): <code><nowiki> <a href="uri"></a> </nowiki></code> Which you can appendChild stuff into. If $target is specified then a target attribute is included - to make it pop up a new window. ; <tt> $item->render_value( $fieldname, $showall ) </tt> : $item is either an EPrint, a User or a Document. $fieldname is the name of the field you want to render. If $showall is 1 then ALL values are rendered in a multilang field. ; <tt> $item->render_citation( $style ) </tt> : Renders the citation of the item using the citation for the item's type from the citation file. If $style is set then it uses the citation with that id instead. ; <tt> $item->render_citation_link( $style ) </tt> : This renders a citation as above, but links it to the url of the item. ; <tt> $item->render_description() </tt> : This renders a simple description of the item using the default citation for this dataset eg. for eprint it uses citation type "eprint". ; <tt> $session->html_phrase( $phraseid, %opts ) </tt> : Returns the item from the phrase file. If you don't care about supporting multiple languages then just use make_text instead, it's easier. It looks first in the archive field from the current language. Then in the archive phrase file for english. Then is the system phrase file for the current language. Then is the system phrase file for the english. The %opts are a series of DOM elements to place in the "pin" items in the phrase file.
Summary:
Please note that all contributions to EPrints Documentation may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
EPrints Documentation:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)