View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Nicholas Bamber > CGI-Application-Plugin-PageLookup > CGI::Application::Plugin::PageLookup::Menu



Annotate this POD


New  3
Open  2
View/Report Bugs
Module Version: 1.8   Source  


CGI::Application::Plugin::PageLookup::Menu - Support for consistent menus across a multilingual website


Version 1.8


The CGI::Application::Plugin::PageLookup::Loop module can be used to create a database driven menu and similarly data driven site map page. However the Loop module can only translate into other languages if the URLs are kept the same apart from a language identifier. This means that the website would have search engine friendly in only one language. The CGI::Application::Plugin::PageLookup::Href module could be used to create a static menu and site map that is automatically translated into various languages with search engine friendly URLs. However they cannot be combined as you cannot pass through first the Loop and then the Href. What this module offers is a specialised variant of the Loop smart object that does combine these features. This module depends on CGI::Application::Plugin::PageLookup.


In the template you might define a menu as follows (with some CSS and javascript to make it look nice):

    <TMPL_LOOP NAME="menu.structure('title')">
                <a href="<TMPL_VAR NAME="this.pageid">"><TMPL_VAR NAME="this.title"></a>
                <TMPL_IF NAME="this.structure('title')">
                <TMPL_LOOP NAME="this.structure('title')">
                                <a href="/<TMPL_VAR NAME="this.pageid">"><TMPL_VAR NAME="this.title"></a>
                                <TMPL_IF NAME="this.structure('title')">
                                <TMPL_LOOP NAME="this.structure('title')">
                                        <a href="/<TMPL_VAR NAME="this.pageid">"><TMPL_VAR NAME="this.title"></a>

and the intention is that this should be the same on all English pages, the same on all Vietnamese pages etc etc. You must register the "menu" parameter as a CGI::Application::Plugin::PageLookup::Menu object as follows:

    use CGI::Application;
    use CGI::Application::Plugin::PageLookup qw(:all);
    use CGI::Application::Plugin::PageLookup::Menu;
    use HTML::Template::Pluggable;
    use HTML::Template::Plugin::Dot;

    sub cgiapp_init {
        my $self = shift;

        # pagelookup depends CGI::Application::DBH;
        $self->dbh_config(......); # whatever arguments are appropriate



                # load smart dot-notation objects
                objects =>
                        # Register the 'values' parameter
                        menu => 'CGI::Application::Plugin::PageLookup::Menu',





A constructor following the requirements set out in CGI::Application::Plugin::PageLookup.


This function is specified in the template where additional columns are specified. If no arguments are specified only the 'pageId' column is returned for each menu item. Additional arguments should be specified either as a single comma separated string (deprecated) or as multiple arguments.


A private function that does what is says.


This function is a variant of the structure function, which allows one to specify a part of the menu. The first argument is the database lineage which is a string consisting of comma separated numbers. The other arguments are as described under structure. The slice function can only be used in the topmost TMPL_LOOP of a template.


Nicholas Bamber, <nicholas at>


Please report any bugs or feature requests to bug-cgi-application-plugin-pagelookup at, or through the web interface at I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.


You can find documentation for this module with the perldoc command.

    perldoc CGI::Application::Plugin::PageLookup::Menu

You can also look for information at:



Copyright 2009 Nicholas Bamber.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See for more information.

syntax highlighting: