Jump to content

EPScript/Examples

From EPrints Documentation


EPScript

Examples[edit]

Pluralising the editors of a book[edit]

 <if test="type = 'book' and is_set(editors)">
   <print expr="editors" />, (ed<if test="length(editors) gt 1">s</if>
 </if>

Rendering the URL of an EPrint[edit]

 <print expr="$config{base_url}" />/<print expr="eprintid" />/

Testing a boolean field[edit]

Boolean fields can be TRUE, FALSE or an empty string, the last of which means neither the true or false option has been selected. Just doing a test="boolean_field" isn't enough. Use this:

 <if test="boolean_field = 'TRUE'">
   ...
 </if>

If you want to test if neither a true or false option has been selected, you will need to use:

 <if test="boolean_field = ''">
   ...
 </if>