# shlomi-fish-homepage / bin / Test / render-breadcrumbs-trail.pl

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 #!/usr/bin/perl use strict; use warnings; use MyNavData; use HTML::Widgets::NavMenu; use CGI qw(); use MyNavLinks; my $my_THE_filename = "puzzles/situation/book-under-rock.html"; { my$filename = $my_THE_filename;$filename =~ s{index\.html$}{};$filename = "/$filename"; use vars qw($nav_bar); $nav_bar = HTML::Widgets::NavMenu->new( 'path_info' =>$filename, 'current_host' => "t2", MyNavData::get_params(), 'ul_classes' => [ "navbarmain", ("navbarnested") x 10 ], ); my $rendered_results =$nav_bar->render(); use vars qw($nav_links);$nav_links = $rendered_results->{nav_links}; use vars qw($nav_links_obj); $nav_links_obj =$rendered_results->{nav_links_obj}; use vars qw($nav_html);$nav_html = $rendered_results->{html}; use vars qw($leading_path); $leading_path =$rendered_results->{leading_path}; my $render_leading_path_component = sub { my$component = shift; my $title =$component->title(); my $title_attr = defined($title) ? " title=\"$title\"" : ""; return "direct_url()) . "\"$title_attr>" . $component->label() . ""; }; use vars qw($leading_path_string); $leading_path_string = join(" → ", (map {$render_leading_path_component->($_) } @$leading_path )); use vars qw($nav_links_renderer);$nav_links_renderer = MyNavLinks->new( 'nav_links' => $nav_links, 'nav_links_obj' =>$nav_links_obj, 'root' => "../..", ); } use MySectNavData; use vars (qw($section_nav_menu)); sub init_section_nav_menu { if (defined($section_nav_menu)) { return; } my $filename =$my_THE_filename; $filename =~ s{index\.html$}{}; $filename = "/$filename"; $section_nav_menu = MySectNavData::get_nav_menu( 'path_info' =>$filename, 'current_host' => "t2", 'root' => "../..", ); return; } init_section_nav_menu(); my $total_leading_path =$section_nav_menu->total_leading_path( { main_leading_path => $leading_path, } ); my$render_leading_path_component = sub { my $component = shift; my$title = $component->title(); my$title_attr = defined($title) ? " title=\"$title\"" : ""; return "direct_url()) . "\"$title_attr>" .$component->label() . ""; }; print join(" → ", (map { $render_leading_path_component->($_) } @\$total_leading_path ));