Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^4: How do you use Template Toolkit with Dancer2?

by choroba (Cardinal)
on Apr 27, 2022 at 18:36 UTC ( [id://11143361]=note: print w/replies, xml ) Need Help??


in reply to Re^3: How do you use Template Toolkit with Dancer2?
in thread How do you use Template Toolkit with Dancer2?

Yes, you're breaking the Model - View - Controller paradigm. You can include the dropdown menu template from other templates, sending only the data from the code (i.e. no "dropdown_menu" in the code).

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Replies are listed 'Best First'.
Re^5: How do you use Template Toolkit with Dancer2?
by PiotrS (Novice) on Apr 29, 2022 at 01:07 UTC
    Thank you for your answer. If a menu template can be included in a "parent" template, how would one go about including two or more menus in the "parent" template, where the difference is only the menu's name and the data-set. Wouldn't that introduce ambiguity to the assignment of variables within the menu template?
      That's why templates have their arguments, too. See INCLUDE:
      [% INCLUDE template var = val, ... %]

      map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11143361]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2024-04-25 07:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found