Kyshtynbai has asked for the wisdom of the Perl Monks concerning the following question:
I also have a main.html.ep which is a layout for all the other "pages". Here it is:helper thumbs => sub { my @thumbs; my $dir = 'public/images/thumbs'; my $dh; opendir $dh, $dir; foreach (readdir $dh) { next if /^\.$|^\.\.$/; #let's assume there are no files in thi +s dir, only dirs. push @thumbs, $_; } closedir $dh; return @thumbs; };
As you can see, this layout includes "header.html.ep" template, and it is where drop-down menu is generated. The quesion is: how do I pass the arrayref of @thumbs array to the header.html.ep template? This header.html.ep is stored in "templates" directory and it is not even mentioned in mainapp.pl! In case you need it, I provide the code for header.html.ep, but it is not very important in this case:<html> <head> <link rel="stylesheet" href="../main.css"> <body> %= include 'header' <div id="main_div"> <div id="menu"> <ul> <li>link1</li> <li>link2</li> <li>link3</li> </ul> </div> <div id="r_menu"> <div class="inner_block_1"> some block </div> <div id="content"> <%= content %> </div> </div> <div id="footer"> <p> Footer info. </p> </div> </body> </html>
Thank you in advance!<div id="header"> <div id="top_menu"> <ul id="menul"> <li><a href="/index">Root</a></li> <li><a href="/quotes">Quotes</a></li> <li id="sub1">Pics <ul> <% some perl code to generate <li> tags <li><a href="vu">pic</a></li> </ul> </li> <li><a href = "/logout">Выйти</a></l +i> </ul> </div> </div>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Mojolicious, layouts and content generating.
by neilwatson (Priest) on Jun 10, 2014 at 11:31 UTC | |
by Kyshtynbai (Sexton) on Jun 10, 2014 at 11:33 UTC | |
by davido (Cardinal) on Jun 10, 2014 at 16:21 UTC | |
|
Re: Mojolicious, layouts and content generating.
by Anonymous Monk on Jun 10, 2014 at 07:13 UTC | |
by Anonymous Monk on Jun 10, 2014 at 07:19 UTC |