https://wiki.eprints.org/w/index.php?title=API:perl_lib/EPrints/Apache/Template.pm&feed=atom&action=historyAPI:perl lib/EPrints/Apache/Template.pm - Revision history2024-03-29T00:08:22ZRevision history for this page on the wikiMediaWiki 1.31.8https://wiki.eprints.org/w/index.php?title=API:perl_lib/EPrints/Apache/Template.pm&diff=10438&oldid=prevTdb01r: 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…'2012-04-16T15:52:21Z<p>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…'</p>
<p><b>New page</b></p><div><!-- Pod2Wiki=_preamble_ <br />
This page has been automatically generated from the EPrints 3.2 source. Any wiki changes made between the 'Pod2Wiki=*' and 'Edit below this comment' comments will be lost.<br />
-->{{API}}{{Pod2Wiki}}{{API:Source|file=perl_lib/EPrints/Apache/Template.pm|package_name=perl_lib/EPrints/Apache/Template.pm}}[[Category:API|PERL_LIB/EPRINTS/APACHE/TEMPLATE.PM]][[Category:API:perl_lib/EPrints/Apache/Template.pm|PERL_LIB/EPRINTS/APACHE/TEMPLATE.PM]][[Category:API:perl_lib/EPrints/Apache/Template.pm|PERL_LIB/EPRINTS/APACHE/TEMPLATE.PM]]<div><!-- Edit below this comment --><br />
<br />
<br />
<!-- Pod2Wiki=_private_ --><!-- Pod2Wiki=head_name --><br />
==NAME==<br />
'''EPrints::Apache::Template''' - Template Applying Module<br />
<br />
<!-- Edit below this comment --><br />
<br />
<br />
<!-- Pod2Wiki= --><br />
<!-- Pod2Wiki=head_synopsis --><br />
==SYNOPSIS==<br />
<source lang="perl"><?xml version="1.0" standalone="no"?><br />
<!DOCTYPE html SYSTEM "entities.dtd"><br />
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epc="http://eprints.org/ep3/control"><br />
<head><br />
<title><epc:pin ref="title" textonly="yes"/> - <epc:phrase ref="archive_name"/></title><br />
...</source><br />
<br />
<!-- Edit below this comment --><br />
<br />
<br />
<!-- Pod2Wiki= --><br />
<!-- Pod2Wiki=head_description --><br />
==DESCRIPTION==<br />
This module renders HTML page content using a template.<br />
<br />
Templates are parsed and rendered at server start-up, expanding phrases and any EPC. If you need to include dynamic content in the page use use a pin generated via {{API:PodLink|file=perl_lib|package_name=perl_lib|section=EPrints|text=perl_lib/EPrints/Apache/Template.pm/Dynamic Pins}}.<br />
<br />
The page title, content and other core page structures are supplied via {{API:PodLink|file=perl_lib|package_name=perl_lib|section=EPrints|text=perl_lib/EPrints/Apache/Template.pm/Default Pins}}.<br />
<br />
<!-- Edit below this comment --><br />
<br />
<br />
<!-- Pod2Wiki= --><br />
<!-- Pod2Wiki=head_static_html_pages --><br />
===Static HTML Pages===<br />
Static files with the ''.xpage'' extension are rendered using templates:<br />
<br />
<pre> &lt;?xml version="1.0" encoding="utf-8" standalone="no" ?&gt;<br />
&lt;!DOCTYPE page SYSTEM "entities.dtd" &gt;<br />
&lt;xpage:page xmlns="http://www.w3.org/1999/xhtml" xmlns:xpage="http://eprints.org/ep3/xpage" xmlns:epc="http://eprints.org/ep3/control"&gt;<br />
&lt;xpage:template&gt;default&lt;/xpage:template&gt;<br />
&lt;xpage:head&gt;<br />
&lt;style type="text/css"&gt;h1 { text-weight: bold }&lt;/style&gt;<br />
&lt;/xpage:head&gt;<br />
&lt;xpage:title&gt;My first XPage&lt;/xpage:title&gt;<br />
&lt;xpage:body&gt;<br />
Writing XPages is easy.<br />
&lt;/xpage:body&gt;<br />
&lt;/xpage:page&gt;</pre><br />
<br />
<code>&lt;xpage:template&gt;</code> is a special pin that, instead of supplying content to the template, changes the template used for rendering. The content is just the template name (without the ''.xml'' extension).<br />
<br />
<!-- Edit below this comment --><br />
<br />
<br />
<!-- Pod2Wiki= --><br />
<!-- Pod2Wiki=head_default_pins --><br />
===Default Pins===<br />
* title<br />
: The title of the page.<br />
<br />
* page<br />
: The page content.<br />
<br />
* login_status_header<br />
: HTML &lt;head&gt; includes for the login status of the user - currently just some JavaScript variables.<br />
<br />
* head<br />
: Page-specific HTML &lt;head&gt; contents.<br />
<br />
* pagetop<br />
: (Unused?)<br />
<br />
* login_status<br />
: A menu containing [[API:EPrints/Plugin/Screen|EPrints::Plugin::Screen]]s that appear in <code>key_tools</code>. The content from each plugin's <code>render_action_link</code> is rendered as a HTML &lt;ul&gt; list.<br />
<br />
: Historically this was the login/logout links plus <code>key_tools</code> but since 3.3 login/logout are Screen plugins as well.<br />
<br />
* languages<br />
: The <code>render_action_link</code> from [[API:EPrints/Plugin/Screen/SetLang|EPrints::Plugin::Screen::SetLang]].<br />
<br />
<!-- Edit below this comment --><br />
<br />
<br />
<!-- Pod2Wiki= --><br />
<!-- Pod2Wiki=head_dynamic_pins --><br />
===Dynamic Pins===<br />
In <code>cfg.d/dynamic_template.pl</code>:<br />
<br />
<pre> $c-&gt;{dynamic_template}-&gt;{function} = sub {<br />
my( $repo, $parts ) = @_;<br />
<br />
$parts->{mypin} = $repo->xml->create_text_node( "Hello, World!" );<br />
};</pre><br />
<br />
In <code>archives/[archiveid]/cfg/templates/default.xml</code> (copy from <code>lib/templates/default.xml</code> if not already exists):<br />
<br />
<pre> &lt;epc:pin ref="mypin" /&gt;</pre><br />
<br />
Or, for just the text content of a pin:<br />
<br />
<pre> &lt;epc:pin ref="mypin" textonly="yes" /&gt;</pre><br />
<br />
<!-- Edit below this comment --><br />
<br />
<br />
<!-- Pod2Wiki= --><br />
<!-- Pod2Wiki=head_methods --><br />
==METHODS==<br />
<!-- Edit below this comment --><br />
<br />
<br />
<!-- Pod2Wiki= --><br />
<!-- Pod2Wiki=head_see_also --><br />
==SEE ALSO==<br />
The directories scanned for template sources are in [[API:EPrints/Repository#template_dirs|EPrints::Repository/template_dirs]].<br />
<br />
<!-- Edit below this comment --><br />
<br />
<br />
<!-- Pod2Wiki= --><br />
<!-- Pod2Wiki=head_copyright --><br />
==COPYRIGHT==<br />
Copyright 2000-2011 University of Southampton.<br />
<br />
This file is part of EPrints http://www.eprints.org/.<br />
<br />
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.<br />
<br />
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.<br />
<br />
You should have received a copy of the GNU Lesser General Public License along with EPrints. If not, see http://www.gnu.org/licenses/.<br />
<br />
<!-- Edit below this comment --><br />
<br />
<br />
<!-- Pod2Wiki= --><br />
<!-- Pod2Wiki=_postamble_ --><br />
<!-- Edit below this comment --></div>Tdb01r