API:EPrints/XHTML

From EPrints Documentation
Revision as of 13:21, 25 February 2010 by Tdb01r (talk | contribs) (Created page with '<!-- Pod2Wiki=_preamble_ This page has been automatically generated from the EPrints 3.2 source. Any wiki changes made between the 'Pod2Wiki=*' and 'Edit below this comment' com…')
(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


API: Core API

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


NAME

EPrints::XHTML - XHTML Module

User Comments


SYNOPSIS

 $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 );
 
 $page = $xhtml->page( %opts );
 

User Comments


DESCRIPTION

The XHTML object facilitates the creation of XHTML objects.

User Comments


METHODS

User Comments


form

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

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

User Comments


input_field

$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.

User Comments


hidden_field

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

Returns an XHTML hidden input field.

User Comments


text_area_field

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

Returns an XHTML textarea input.

User Comments


data_element

$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

User Comments


to_xhtml

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

Returns $node as valid XHTML.

User Comments


to_text_dump

$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.

Options:

 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.

User Comments


page

$page = $xhtml->page( $map, %opts )

Returns an EPrints::Page object describing an XHTML page filled out with the templates provided in $map.

$map is a hash of XHTML DOM fragments. At least "title" and "page" should be defined. Use "links" to add items to the header.

Option "page_id" set's the XML id of the <body> to be "page_YOURID". Useful when you want to use CSS to tweak elements on one page only.

Option "template" uses a different template to "default.xml".

User Comments