Apache2-PageKit
view release on metacpan or search on metacpan
docsrc/features.xml view on Meta::CPAN
to return the node or the set of nodes whose <literal>xml:lang</literal>
attribute(s) are the same as the preferred language. If the node
has no <literal>xml:lang</literal>, then the value of the
<literal>xml:lang</literal> attribute on the nearest ancestor is used.
If the node and the its ancestors have no <literal>xml:lang</literal>
attribute, then the <literal><link linkend="config.global.default_lang">default_lang</link></literal>
language is used.
</para>
</listitem>
<listitem>
<para>
If no nodes are found in the preferred language, then
it returns the node(s) which are in the
<literal><link linkend="config.global.default_lang">default_lang</link></literal>
language.
</para>
</listitem>
</itemizedlist>
<para>
The algorithm in PageKit 1.00 is slightly different from the above,
but follows the same basic idea.
</para>
</sect2>
<sect2>
<title>Applying to Content: XSLT</title>
<para>
As of release 1.00 there is no support for Language Localization using
XSLT. However I plan to offer support in one of the two following ways:
</para>
<itemizedlist>
<listitem>
<para>
Different source XML files, <filename>foo.en</filename>,
<filename>foo.de</filename>, <filename>foo.es</filename>, and so on.
</para>
</listitem>
<listitem>
<para>
PageKit will set the <literal><xsl:param name="pkit_lang"></literal>
tag in the XSLT stylesheet.
</para>
</listitem>
</itemizedlist>
<para>
Comments, suggestions, and patches welcome!
</para>
</sect2>
<sect2>
<title>Applying to Model</title>
<para>
To use the language settings from the Model, simply use the
<literal><link linkend="model.api.pkit_lang">pkit_lang</link></literal> method.
</para>
<para>
This can be useful for selecting content from the database based on language.
</para>
</sect2>
<sect2>
<title>Character set translation</title>
<para>
By default, PageKit attempts to output using <link linkend="config.global.default_output_charset">default_output_charset</link>.
PageKit will attempt to translate the PageKit Templates and output passed
to <link linkend="model.api.output_convert">output_convert</link> from
<link linkend="config.global.default_input_charset">default_input_charset</link> to
<link linkend="config.global.default_output_charset">default_output_charset</link>.
</para>
<para>
Note: This also applies also to the message catalog if any. So write your message catalog files in
<link linkend="config.global.default_input_charset">default_input_charset</link>.
</para>
<para>
PageKit attempts to translate the output to a character set that is specified in the <literal>Accept-Charset</literal> header. If this is not possible,
PageKit delivers the page in the <link linkend="config.global.default_output_charset">default_output_charset</link>.
</para>
</sect2>
</sect1>
<sect1>
<title>Caching</title>
<para>
Currently PageKit supports on-disk caching of compiled PageKit Templates.
Future versions should also include in-memory caching and caching
of Model output.
</para>
<para>
XSL transformations are also cached, taking into account any input
request parameters that are used in <literal>xsl:param</literal> tags
contained in the top-level the XSLT file.
</para>
</sect1>
<sect1><?dbhtml filename="component.html"?>
<title>Component based architecture</title>
<para>
Components are similar to Server Side Includes (SSIs), in that the
include PageKit Templates inside other PageKit Templates. However, the
can also have code associated with them that fills in the
<link linkend="model.tags">Model Tags</link>, including
<MODEL_VAR>, <MODEL_LOOP>, and <MODEL_IF>.
</para>
<para>
The <link linkend="pkit.component">PKIT_COMPONENT</link> tag specifies
where the component should be included. The Component can either
be a PageKit Template file, or a PageKit Template generated from the
<filename>Content/<replaceable>component_id</replaceable>.xml</filename>
XML file.
</para>
<para>
The following example illustration how absolute and relative paths
work:
</para>
<informalexample>
<programlisting>
# absolute path - includes View/<replaceable>pkit_view</replaceable>/foo/bar.tmpl
# or output generated from Content/foo/bar.xml
<PKIT_COMPONENT NAME="/foo/bar">
# relative path, includes the bar.tmpl or bar.xml in the directory
# of the enclosing PageKit Template/XML File.
<PKIT_COMPONENT NAME="bar">
</programlisting>
</informalexample>
</sect1>
<sect1><?dbhtml filename="session.html"?>
<title>Sessions</title>
<para>
PageKit uses a subclass of <ulink url="http://kobesearch.cpan.org/search?dist=Apache-SessionX">Apache::SessionX</ulink> to provide sessions.
It sets a cookie named <literal>pkit_session_id</literal> with an
expiration of <literal><link linkend="config.global.session_expires">session_expires</link></literal>, if applicable.
</para>
<para>
To access the session, use
<informalexample>
<programlisting>
# gets hash tied to Session
my $session = $model->session;
( run in 0.892 second using v1.01-cache-2.11-cpan-39bf76dae61 )