Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Template Toolkit foreach loop

by rnewsham (Chaplain)
on Mar 07, 2013 at 10:34 UTC ( #1022189=note: print w/replies, xml ) Need Help??


in reply to Template Toolkit foreach loop

Without a dump of the data which is being sent to template toolkit or a clearer description of how you want them grouped it is difficult to say.

Assuming you have an array of hashes named files, with date as a key in each hash, containing the date as formatted in your question. You could do something like this.

[% FOREACH file=files %] [% IF ( matches = file.date.match('dd/mm/(\d+)') ) %] <a href='#'>[% matches.0 %]</a> [% END %] [% END %]

Replies are listed 'Best First'.
Re^2: Template Toolkit foreach loop
by sundialsvc4 (Abbot) on Mar 07, 2013 at 14:34 UTC

    I tend to try to put logic concerns in the application, and presentation concerns in the template.   Usually, one subroutine is called to build the page.   It assembles information in its local variables, sometimes also defines a “closure” (a code-ref) that the template will use to withdraw the information that it needs, then invokes the template.   The information it needs is prepared in advance.   The template drives how it looks, and if Marketing wants to completely re-design that, the program won’t break.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1022189]
help
Chatterbox?
[pryrt]: Is there a way to search for/list "nodes I've voted on"? (I thought there was, but cannot find it now)
[choroba]: Your votes in your profile?
[ambrus]: pryrt: yes, there is. link "Your votes" from your profile page.
[ambrus]: (That link work two ways: from your own profile page, it lists all your votes; from anyone else's profile page, it lists your votes on that user's nodes only.)
[choroba]: Wow, and I can create an interesting statistics from it
[LanX]: I've also added a link "my votes" to the personal nodelet
[pryrt]: Thanks, that was what I was looking for

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (13)
As of 2017-03-29 13:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (351 votes). Check out past polls.