[% PERL %] use CGI::Carp 'fatalsToBrowser'; use Tie::IxHash; tie my %pages, 'Tie::IxHash'; %pages = ( contents => 'Contents', what => 'What is OpenGuides?', why => 'Why does it exist?', how1 => 'How it was made (1)', how2 => 'How it was made (2)', features => 'What it can do', where => 'Where can you find it?', thanks => 'Thank You' ); my (%title_order, %number_order); my @title_list = keys %pages; for (0..$#title_list) { $title_order{$title_list[$_]} = $_; } while (my ($page_name, $page_number) = each %title_order) { $number_order{$page_number} = $page_name; } my $current_page_number = $title_order{'[% page %]'}; my $next_page = $number_order{$current_page_number + 1}; my $prev_page = $number_order{$current_page_number - 1}; $stash->set('next', $next_page); $stash->set('prev', $prev_page); $stash->set('title', $pages{'[% page %]'}); [% END %] [% INCLUDE header; INCLUDE $page; INCLUDE footer %]