NAME

Apache::PageKit::Content - Parses and stores content in XML files.

DESCRIPTION

The module loads data from XML files stored in the Content/XML directory under the PageKit root directory. Upon server startup, it parses the XML files and stores the data structures in Content/Cache directory. It then loads the data from the cache when a page is requested.

SYNOPSIS

Load content into cache, called when web server starts.

  my $content = Apache::PageKit::Content->new(content_dir => $content_dir,
					default_lang => $default_lang,
					reload => 'yes');
  $content->parse_all;

Load content from cache into view object.

  my $content = Apache::PageKit::Content->new(content_dir => $content_dir,
					default_lang => $default_lang,
					lang_arrayref => $lang_arrayref,
					reload => 'yes');
  my $param_hashref = $content->get_param_hashref($page_id, $iso_lang);

METHODS

The following methods are available to the user:

parse_all

Load content into cache, called when web server starts.

  my $content = Apache::PageKit::Content->new(content_dir => $content_dir,
					default_lang => $default_lang,
					reload => 'yes');
  $content->parse_all;
get_param_hashref

Load content from cache, returns hash reference containing parameters that can be loaded into HTML::Template.

  my $content = Apache::PageKit::Content->new(content_dir => $content_dir,
					default_lang => $default_lang,
					lang_arrayref => $lang_arrayref,
					reload => 'yes');
  my $param_hashref = $content->get_param_hashref($page_id, $iso_lang);

XML Tags

The following tags are allowed in the Content XML files:

<PAGE>

This tag contains <CONTENT_VAR> and <CONTENT_LOOP> tags for the content of the page specified by <I>id</I>.

<PAGE id="welcome" cache="yes">
  <CONTENT_VAR NAME="title" xml:lang="en">Title in English</CONTENT_VAR>
</PAGE>

If the <I>cache</I> attribute is set to <I>yes</I>, then content will be stored in memory instead of a cache file for all languages. If <I>cache</I> is set to <I>default</I>, then the content will be stored in memory for the default application. The default setting for <I>cache</I> is <I>no</i>, which stores the content in cache files.

<CONTENT_VAR>

Corresponds to <CONTENT_VAR> tag in HTML::Template file.

<CONTENT_VAR NAME="title" xml:lang="en"><![CDATA[Title in English]]></CONTENT_VAR>
<CONTENT_VAR NAME="title" xml:lang="es"><![CDATA[Titulo en Espanol]]></CONTENT_VAR>
<CONTENT_ITEM> and <CONTENT_LOOP>

Corresponds to <CONTENT_LOOP> tag in HTML::Template file.

<CONTENT_LOOP NAME="news">
  <CONTENT_ITEM>
    <CONTENT_VAR NAME = "date">August 28th, 2000</CONTENT_VAR>
    <CONTENT_VAR NAME = "title">Release of PageKit 0.02</CONTENT_VAR>
    <CONTENT_VAR NAME = "description">Added XML support for attributes and content</CONTENT_VAR>
  </CONTENT_ITEM>
  <CONTENT_ITEM>
    <CONTENT_VAR NAME = "date">August 24th, 2000</CONTENT_VAR>
    <CONTENT_VAR NAME = "title">Release of PageKit 0.01</CONTENT_VAR>
    <CONTENT_VAR NAME = "description">Initial Release</CONTENT_VAR>
  </CONTENT_ITEM>
</CONTENT_LOOP>

This example is from the content file for the front page of the pagekit website at http://www.pagekit.org/

<NAV_TITLE>

Sets the title used in <PKIT_LOOP NAME="BREAD_CRUMB"> </PKIT_LOOP> and <PKIT_VAR NAME="LAST_CRUMB">.

<NAV_TITLE xml:lang="de">Oberseite</NAV_TITLE>
<NAV_TITLE xml:lang="en">Home</NAV_TITLE>
<NAV_TITLE xml:lang="es">Tapa</NAV_TITLE>
<NAV_TITLE xml:lang="fr">Dessus</NAV_TITLE>

AUTHOR

T.J. Mather (tjmather@anidea.com)

BUGS

Embeded <CONTENT_LOOP>'s in the XML file have not been tested.

COPYRIGHT

Copyright (c) 2000, AnIdea Corporation. All rights Reserved. PageKit is a trademark of AnIdea Corporation.

LICENSE

This program 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 Ricoh Source Code Public License for more details.

You can redistribute this module and/or modify it only under the terms of the Ricoh Source Code Public License.

You should have received a copy of the Ricoh Source Code Public License along with this program; if not, obtain one at http://www.pagekit.org/license

1 POD Error

The following errors were encountered while parsing the POD:

Around line 348:

You forgot a '=back' before '=head1'