title: Passing parameters to helper in Meteor's dynamic templates
body: <p>I realise that this has been brought up before, and that <code>Template.dynamic</code> isn't designed to take in a parameter if its template parameter is a helper.</p>
  
  <p>But here is what I would like to do:</p>
  
  <pre class="lang-js prettyprint-override"><code>// a global helper that composites the template's name using domain-specific and global parameters
  Template.registerHelper('templateName', function (name) {
    return name + Session.get('someVariable');
  });
  </code></pre>
  
  <pre class="lang-html prettyprint-override"><code>&lt;!-- use case: a template calling two dynamic ones --&gt;
  &lt;template name="someTemplate"&gt;
    &lt;div class="some-class"&gt;
      {{&gt; Template.dynamic template=templateName 'title' }}
    &lt;/div&gt;
    &lt;div class="another-class"&gt;
      {{&gt; Template.dynamic template=templateName 'content' }}
    &lt;/div&gt;
  &lt;/template&gt;
  </code></pre>
  
  <p>This pattern is extremely DRY and it avoids having to set up nested conditionals and rewrite quasi-identical templates each with minimal changes.</p>
  
  <p>Right now, I've got this:</p>
  
  <pre class="lang-js prettyprint-override"><code>Template.registerHelper('templateName', function () {
    var dt = this.dName || Template.parentData().dName;
    return dName + Session.get('someVariable'));
  });
  </code></pre>
  
  <pre class="lang-html prettyprint-override"><code>&lt;template name="someTemplate"&gt;
    {{&gt; segment dName="title"}}
    {{&gt; segment dName="content"}}
  &lt;/template&gt;
  
  &lt;template name="segment"&gt;
    &lt;div class="some-class"&gt;
      {{&gt; Template.dynamic template=templateName }}
    &lt;/div&gt;
  &lt;/template&gt;
  </code></pre>
  
  <p>It works, but it isn't ideal, because;</p>
  
  <ul>
  <li>confusion-prone need to include the parameter for the dynamic template's name in the parent template's call</li>
  <li>only ever being allowed one <code>Template.dynamic</code> per template due to one parameter, leading to scalability issues</li>
  <li>putting the <code>dName</code> parameter in the template's data context is mixed in with local data, requiring the hacky check whether it's accessible in the current one or the parent's</li>
  <li>any further complexity in the DOM requires lots of nested conditionals for parameters or many slightly different static templates, leading to bloat</li>
  </ul>
  
  <p>Are there plans to add this functionality? Am I going about this the wrong way? Did anyone else run into these issues?</p>
  
  <p>Thanks for reading.</p>