>>>>> "Paul" == Paul <[EMAIL PROTECTED]> writes:
Paul> How would I go about generating site navigation breadcrumbs with TT?
Paul> As in:
Paul> Home > SubSection1 > SubSection2 > CurrentPage
Paul> Subsections are descriptive names for the current directory structure
Paul> that a page resides in. The above "CurrentPage" might be
Paul> /sub1/sub2/index.ttml relative to the docroot.
Paul> Any ideas or previous experience would be greatly appreciated!
I needed a system that divorced the well-known URLs from the "logical"
structure of www.stonehenge.com, so I adopted a different tactic
from the ones given elsewhere in this thread.
Each HTML page declares itself to be a member of a particular class:
[% META
class = wt_columns
instance = 01
title = 'CPAN, NNTP, Clarinet Comics (Apr 96)'
%]
So, this is the button "01" in the group of buttons "wt_columns".
The WT master page also declares itself to be the entry point into
that group:
[% META
class='wt_columns' superclass='columns'
instance='WT Columns'
title='WT Columns by Randal'
%]
By adding "superclass", we automatically become a button in the "columns"
class, pointing downward into this group.
Thus, I can completely control a hierarchy of pages, and make easy
changes.
I then process all this information using Template to extract
the meta info:
use Template;
my $c = Template->new({
RELATIVE => 1,
ABSOLUTE => 1,
})->service->context;
my %bars;
for (@list_of_all_my_html_pages_in_my_source_tree) {
my $d = $c->template($_);
my $class = $d->class or next;
my $instance = $d->instance || "???";
my $title = $d->title || "[no title]";
if (my $super = $d->superclass) {
$bars{$class}{super} = $super;
$bars{$class}{instance} = $instance;
$bars{$class}{title} = $title;
$class = $super;
}
push @{$bars{$class}{buttons}}, [$_, $instance, $title];
}
$bars{top}{title} = "Welcome to stonehenge.com!"; # hack
And then dump that (for now) as a TT data structure. Soon, it'll
be a nice DBD::SQLite database.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.ourshack.com/mailman/listinfo/templates