Jump to content

Pagerange field: Difference between revisions

From EPrints Documentation
Added description. Added ToC. Reorganised other sections
mNo edit summary
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{fieldtypes}}
{{fieldtypes}}


== Description ==
== Description ==
This field is stored as a single text string in the database but is presented as two text fields to fill in a <tt>from</tt> and a <tt>to</tt>.  The text between the two fields is set using the <code>lib/metafield:to</code> phrase.   
This field is stored as a single text string in the database but is presented as two text fields to fill in a <tt>from</tt> and a <tt>to</tt>.  The text between the two fields is set using the <code>lib/metafield:to</code> phrase.   


When the two fields are saved to the database a <tt>-</tt> is added between the <tt>from</tt> and a <tt>to</tt> fields so <tt>5</tt> and <tt>10</tt> becomes <tt>5-10</tt>.  This would then be rendered in a citation using <code>lib/metafield/pagerange:range</code>, by default <tt>pp. 5-10</tt>.  If only the <tt>from</tt> field is entered or is the same as the <tt>to</tt> field then the citation would be rendered using <code>lib/metafield/pagerange:from_page</code> or <code>lib/metafield/pagerange:same_page</code> respectively, by default: <tt>p. 5</tt>, if <tt>from</tt> field is <tt>5</tt>.
When the two fields are saved to the database a <tt>-</tt> is added between the <tt>from</tt> and a <tt>to</tt> fields so <tt>5</tt> and <tt>10</tt> becomes <tt>5-10</tt>.  This would then be rendered in a citation using <code>lib/metafield/pagerange:range</code>, by default <tt>pp. 5-10</tt>.  If only the <tt>from</tt> field is entered or is the same as the <tt>to</tt> field then the citation would be rendered using <code>lib/metafield/pagerange:from_page</code> or <code>lib/metafield/pagerange:same_page</code> respectively.  By default: <tt>p. 5</tt>, if <tt>from</tt> field is <tt>5</tt>.


== Inheritance ==
== Inheritance ==
Line 11: Line 12:
*** [[Pagerange field]]
*** [[Pagerange field]]


== Properties ==
== Additional Properties ==
No extra properties.
As for [[Int field#Additional_Properties|Int fields]].


== Required Phrases ==
== Required Phrases ==
No additional phrases.
No additional phrases beyond those required for [[Int field#Required_Phrases|Int fields]].


== Database ==
== Database ==
Line 21: Line 22:
  fieldname VARCHAR(255)
  fieldname VARCHAR(255)


== API ===
== API ==
See [[API:EPrints/MetaField/Namedset|API page]].
See [[API:EPrints/MetaField/Pagerange|API page]].


== Examples ==
== Examples ==

Latest revision as of 22:52, 9 April 2023


Description[edit]

This field is stored as a single text string in the database but is presented as two text fields to fill in a from and a to. The text between the two fields is set using the lib/metafield:to phrase.

When the two fields are saved to the database a - is added between the from and a to fields so 5 and 10 becomes 5-10. This would then be rendered in a citation using lib/metafield/pagerange:range, by default pp. 5-10. If only the from field is entered or is the same as the to field then the citation would be rendered using lib/metafield/pagerange:from_page or lib/metafield/pagerange:same_page respectively. By default: p. 5, if from field is 5.

Inheritance[edit]

Additional Properties[edit]

As for Int fields.

Required Phrases[edit]

No additional phrases beyond those required for Int fields.

Database[edit]

Pagerange fields are stored in the database as

fieldname VARCHAR(255)

API[edit]

See API page.

Examples[edit]

Most basic example.

{
    name => 'pagerange',
    type => 'pagerange',
}