Difference between revisions of "API:EPrints/Apache/Template"
(17 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
<!-- Pod2Wiki=_preamble_ | <!-- Pod2Wiki=_preamble_ | ||
− | This page has been automatically generated from the EPrints 3. | + | This page has been automatically generated from the EPrints 3.4 source. Any wiki changes made between the 'Pod2Wiki=*' and 'Edit below this comment' comments will be lost. |
− | -->{{API}}{{Pod2Wiki}}{{API:Source|file=EPrints/Apache/Template.pm|package_name=EPrints::Apache::Template}}[[Category:API|TEMPLATE]][[Category:API:EPrints/Apache | + | -->{{API}}{{Pod2Wiki}}{{API:Source|file=EPrints/Apache/Template.pm|package_name=EPrints::Apache::Template}}[[Category:API|TEMPLATE]][[Category:API:EPrints/Apache|TEMPLATE]]<div><!-- Edit below this comment --> |
Line 7: | Line 7: | ||
==NAME== | ==NAME== | ||
'''EPrints::Apache::Template''' - Template Applying Module | '''EPrints::Apache::Template''' - Template Applying Module | ||
+ | |||
+ | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <span style='display:none'>User Comments</span> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki= --> | ||
+ | </div> | ||
+ | <!-- Pod2Wiki=head_description --> | ||
+ | ==DESCRIPTION== | ||
+ | When HTML pages are served by EPrints they are processed through a template written in XML. Most repositories will have two templates - ''default.xml'' for HTTP and ''secure.xml'' for HTTPS. | ||
+ | |||
+ | Templates are parsed at '''server start-up''' and any included phrases are replaced at that point. Because templates persist over the lifetime of a server you do not typically perform any logic within the template itself, instead use a pin generated via [[API:EPrints/Apache/Template#Custom_Pins|Custom Pins]]. | ||
+ | |||
+ | The page content is added to the template via <tt><epc:pins</tt>>. | ||
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 16: | Line 31: | ||
</div> | </div> | ||
<!-- Pod2Wiki=head_synopsis --> | <!-- Pod2Wiki=head_synopsis --> | ||
− | == | + | ===Synopsis=== |
<?xml version="1.0" standalone="no"?> | <?xml version="1.0" standalone="no"?> | ||
<!DOCTYPE html SYSTEM "entities.dtd"> | <!DOCTYPE html SYSTEM "entities.dtd"> | ||
Line 24: | Line 39: | ||
... | ... | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
<span style='display:none'>User Comments</span> | <span style='display:none'>User Comments</span> | ||
Line 46: | Line 48: | ||
<!-- Pod2Wiki=head_custom_pins --> | <!-- Pod2Wiki=head_custom_pins --> | ||
===Custom Pins=== | ===Custom Pins=== | ||
− | In | + | In ''cfg.d/dynamic_template.pl'': |
$c->{dynamic_template}->{function} = sub { | $c->{dynamic_template}->{function} = sub { | ||
Line 54: | Line 56: | ||
}; | }; | ||
− | In | + | In ''archives/[archiveid]/cfg/templates/default.xml'' (copy from ''lib/templates/default.xml'' if not already exists): |
− | + | <epc:pin ref="mypin" /> | |
Or, for just the text content of a pin: | Or, for just the text content of a pin: | ||
Line 105: | Line 107: | ||
====login_status_header==== | ====login_status_header==== | ||
− | HTML <head> includes for the login status of the user - currently just some JavaScript variables. | + | HTML <tt><head</tt>> includes for the login status of the user - currently just some JavaScript variables. |
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 117: | Line 119: | ||
====head==== | ====head==== | ||
− | Page-specific HTML <head> contents. | + | Page-specific HTML <tt><head</tt>> contents. |
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 141: | Line 143: | ||
====login_status==== | ====login_status==== | ||
− | A menu containing [[API:EPrints/Plugin/Screen|EPrints::Plugin::Screen]]s that appear in <tt>key_tools</tt>. The content from each plugin's <tt>render_action_link</tt> is rendered as a HTML <ul> list. | + | A menu containing [[API:EPrints/Plugin/Screen|EPrints::Plugin::Screen]]s that appear in <tt>key_tools</tt>. The content from each plugin's <tt>render_action_link</tt> is rendered as a HTML <tt><ul</tt>> list. |
− | Historically this was the login/logout links plus <tt>key_tools</tt> but since 3.3 login/logout are Screen plugins as well. | + | Historically this was the login/logout links plus <tt>key_tools</tt> but since 3.3 login/logout are Screen plugins as well. |
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 156: | Line 158: | ||
The <tt>render_action_link</tt> from [[API:EPrints/Plugin/Screen/SetLang|EPrints::Plugin::Screen::SetLang]]. | The <tt>render_action_link</tt> from [[API:EPrints/Plugin/Screen/SetLang|EPrints::Plugin::Screen::SetLang]]. | ||
+ | |||
+ | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <span style='display:none'>User Comments</span> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki= --> | ||
+ | </div> | ||
+ | <!-- Pod2Wiki=head_methods --> | ||
+ | ==METHODS== | ||
+ | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <span style='display:none'>User Comments</span> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki= --> | ||
+ | </div> | ||
+ | <!-- Pod2Wiki=item_handler --> | ||
+ | ===handler=== | ||
+ | |||
+ | $rc = EPrints::Apache::Template::handler( $r ) | ||
+ | Handler for applying site layout templates. | ||
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 166: | Line 190: | ||
<!-- Pod2Wiki=head_see_also --> | <!-- Pod2Wiki=head_see_also --> | ||
==SEE ALSO== | ==SEE ALSO== | ||
− | The directories scanned for template sources are in [[API:EPrints/Repository#template_dirs|EPrints::Repository/template_dirs]]. | + | The directories scanned for template sources are in [[API:EPrints/Repository#template_dirs|EPrints::Repository/template_dirs]]. |
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 177: | Line 201: | ||
<!-- Pod2Wiki=head_copyright --> | <!-- Pod2Wiki=head_copyright --> | ||
==COPYRIGHT== | ==COPYRIGHT== | ||
+ | {{API:Copyright}} | ||
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
<span style='display:none'>User Comments</span> | <span style='display:none'>User Comments</span> |
Latest revision as of 17:25, 15 March 2023
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
Contents
NAME
EPrints::Apache::Template - Template Applying Module
DESCRIPTION
When HTML pages are served by EPrints they are processed through a template written in XML. Most repositories will have two templates - default.xml for HTTP and secure.xml for HTTPS.
Templates are parsed at server start-up and any included phrases are replaced at that point. Because templates persist over the lifetime of a server you do not typically perform any logic within the template itself, instead use a pin generated via Custom Pins.
The page content is added to the template via <epc:pins>.
Synopsis
<?xml version="1.0" standalone="no"?> <!DOCTYPE html SYSTEM "entities.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:epc="http://eprints.org/ep3/control"> <head> <title><epc:pin ref="title" textonly="yes"/> - <epc:phrase ref="archive_name"/></title> ...
Custom Pins
In cfg.d/dynamic_template.pl:
$c->{dynamic_template}->{function} = sub { my( $repo, $parts ) = @_; $parts->{mypin} = $repo->xml->create_text_node( "Hello, World!" ); };
In archives/[archiveid]/cfg/templates/default.xml (copy from lib/templates/default.xml if not already exists):
<epc:pin ref="mypin" />
Or, for just the text content of a pin:
<epc:pin ref="mypin" textonly="yes" />
Default Pins
title
The title of the page.
page
The page content.
login_status_header
HTML <head> includes for the login status of the user - currently just some JavaScript variables.
head
Page-specific HTML <head> contents.
pagetop
(Unused?)
login_status
A menu containing EPrints::Plugin::Screens that appear in key_tools. The content from each plugin's render_action_link is rendered as a HTML <ul> list.
Historically this was the login/logout links plus key_tools but since 3.3 login/logout are Screen plugins as well.
languages
The render_action_link from EPrints::Plugin::Screen::SetLang.
METHODS
handler
$rc = EPrints::Apache::Template::handler( $r )
Handler for applying site layout templates.
SEE ALSO
The directories scanned for template sources are in EPrints::Repository/template_dirs.
COPYRIGHT
© Copyright 2000-2024 University of Southampton.
EPrints 3.4 is supplied by EPrints Services.
http://www.eprints.org/eprints-3.4/
LICENSE
This file is part of EPrints 3.4 http://www.eprints.org/.
EPrints 3.4 and this file are released under the terms of the GNU Lesser General Public License version 3 as published by the Free Software Foundation unless otherwise stated.
EPrints 3.4 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 3.4. If not, see http://www.gnu.org/licenses/.