From EPrints Documentation
Revision as of 09:56, 22 January 2013 by Tdb01r (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects


Latest Source Code (3.4, 3.3) | Revision Log | Before editing this page please read Pod2Wiki


EPrints::XHTML - XHTML Module


$xhtml = $repo->xhtml;

$utf8_string = $xhtml->to_xhtml( $dom_node, %opts );

$xhtml_dom_node = $xhtml->input_field( $name, $value, type => "text" );
$xhtml_dom_node = $xhtml->hidden_field( $name, $value );
$xhtml_dom_node = $xhtml->text_area_field( $name, $value, rows => 4 );
$xhtml_dom_node = $xhtml->form( "get", $url );

$xhtml_dom_node = $xhtml->data_element( $name, $value, indent => 4 );


  $xhtml->tree([ # dl
    [ "fruit", # dt
      [ "apple", "orange", ], # ul {li, li}
    [ "vegetable", # dt
      [ "potato", "carrot", ], # ul {li, li}
    [ "animal", # dt
      [ "cat", # dt
        [ "lion", "leopard", ], # ul {li, li}
    "soup", # ul {li}
    $xml->create_element( "p" ), # <p> is appended
  <p />


The XHTML object facilitates the creation of XHTML objects.



$node = $xhtml->form( $method [, $action] )

Returns an XHTML form. If $action isn't defined uses the current URL.


$node = $xhtml->input_field( $name, $value, %opts )
  $node = $xhtml->input_field( "name", "Bob", type => "text" );

Returns an XHTML input field with name $name and value $value. Specify "noenter" to prevent the form being submitted when the user presses the enter key.


$node = $xhtml->hidden_field( $name, $value, %opts );

Returns an XHTML hidden input field.


$node = $xhtml->action_button( $name, $value, %opts )

Creates a submit button that is styled to an EPrints form button.

$value is the text shown on the button.


$node = $xhtml->action_icon( $name, $src, %opts )

Creates an image button that links to $src.

For usability it is strongly recommended to supply the alt= attribute.


$node = $xhtml->text_area_field( $name, $value, %opts )

Returns an XHTML textarea input.


$node = $xhtml->data_element( $name, $value, %opts )

Create a new element named $name containing a text node containing $value.

Options: indent - amount of whitespace to indent by


$utf8_string = $xhtml->to_xhtml( $node, %opts )

Returns $node as valid XHTML.


$string = $xhtml->to_text_dump( $tree, %opts )

Dumps the XHTML contents of $tree as a utf8 string, stripping tags and converting common HTML layout elements into their plain-text equivalent.


  width - word-wrap after the given number of columns
  show_links - see below
  preformatted - equivalent to wrapping $tree in <pre></pre>

XHTML elements are removed with the following exceptions:

<br /> is replaced by a newline.

<p>...</p> will have a blank line above and below.

<img /> is replaced with the content of the alt attribute.

<hr /> will insert a line of dashes if width is set.

<a href="foo">bar</a> will be replaced by "bar <foo>" if show_links is set.


$node = $xhtml->box( $content, %opts )

Render a collapsible box.


  • basename = ep_box
Prefix to use for identifying page elements.
  • collapsed = 1
Should the box start rolled up.
  • show_label
Label shown when the box is hidden (in the link).
  • hide_label
Label shown when the box is visible (in the link).
  • show_icon_url = "style/images/plus.png"
The url of the icon to use instead of the [+].
  • hide_icon_url = "style/images/minus.png"
The url of the icon to use instead of the [-].


$node = $xhtml->tabs( $labels, $contents, %opts )

Render a tabbed box where:

 labels - an array of label XHTML fragments
 contents - an array of content XHTML fragments


 base_url - the link to follow under non-JS (default = current URL)
 basename - prefix for tab identifiers (default = "ep_tabs")
 current - index of tab to show first (default = 0)
 expensive - array of tabs to not javascript-link
 aliases - map tab index to alias name


$node = $xhtml->tree( $root, OPTIONS )

Render a tree using definition lists (DLs).


  prefix - id to use for the parent <div>
    HTML class to use for div and prefix for open/close, defaults to
    'prefix' option
  render_value - custom renderer for values


$node = $xhtml->action_list( $actions, %opts )

Returns an unordered list (<UL>) of actions on a single line. $actions is an array reference of XHTML fragments (e.g. icons or buttons).


$node = $xhtml->action_definition_list( $actions, $definitions, %opts )

Returns a definition list (<DL>) of actions plus their definitions. $actions is an array reference of XHTML fragments (e.g. icons or buttons).


$str = $xhtml->doc_type

Returns the default DOCTYPE as a string.


Copyright 2000-2011 University of Southampton.

This file is part of EPrints http://www.eprints.org/.

EPrints is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

EPrints is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with EPrints. If not, see http://www.gnu.org/licenses/.