View on
MetaCPAN
Steve Kemp > App-Templer-1.2 > Templer::Plugin::Breadcrumbs

Download:
App-Templer-1.2.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Source  

NAME ^

Templer::Plugin::Breadcrumbs - A plugin to create breadcrumbs

SYNOPSIS ^

The following is a good example use of this plugin

  title: About my site
  crumbs: Home,Software
  ----
  <p>This is my page content...</p>

Here the variable 'crumbs' will be converted into a loop variable called 'breadcrumbs'. THe links and titls will be set automatically, but if you need to override them you can do so via:

  title: About my site
  crumbs: Home,Software[Soft],Testing[Test]
  ----
  <p>This is my page content...</p>

That will result in links to /, /Soft, and /Soft/Test, respectively. With display names of "Home", "Software" and "Testing".

DESCRIPTION ^

This plugin expands the values of "crumbs", as written in a template, to a loop-variable with the name "breadcrumbs".

This can be used in a template like so:

   <!-- tmpl_if name='breadcrumbs' -->
   <ul>
   <!-- tmpl_loop name='breadcrumbs' -->
    <li><a href="<!-- tmpl_var name='link' -->"><!-- tmpl_var name='title' --></a></li>
   <!-- /tmpl_loop -->
   </ul>
   <!-- /tmpl_if -->

This template is an example.

LICENSE ^

This module is free software; you can redistribute it and/or modify it under the terms of either:

a) the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version, or

b) the Perl "Artistic License".

AUTHOR ^

Steve Kemp <steve@steve.org.uk>

COPYRIGHT AND LICENSE ^

Copyright (C) 2015 Steve Kemp <steve@steve.org.uk>.

This library is free software. You can modify and or distribute it under the same terms as Perl itself.

METHODS ^

new

Constructor. No arguments are required/supported.

expand_variables

This is the method which is called by the Templer::Plugin::Factory to expand the variables contained in a Templer::Site::Page object.

This method will expand any variable that is called 'crumbs' into a HTML::Template loop, suitable for the display of breadcrumbs.

syntax highlighting: