Error Using Variable As Parameter

‘{{> main_template content = {{{current}}} }}’

Why won’t this ‘current’ variable get accepted as a string variable?

Thanks

I don’t believe you can nest helpers like that. Question, unless I am missing something, what about using something like

{{ > Template.dynamic template='current' }} => Edited this, forgot the quotes

And for handling current

<template name="current">
   {{{ myHelper }}}
</template>

I don’t understand. What I am trying to achieve is basically making a template with header and footer but current defines what is between the header and footer. I want the template within the template to be dynamic for page to page. So I am trying to make the equivalent of an editable region within Dreamweaver. You got me?

Thanks

@jrudio has the right approach for what you want to achieve (I think … I have no idea what a Dreamweaver editable region is).

You want to dynamically be able to show alternative content between your header and footer?

<body>
  {{> header}}
  {{> main }}
  {{> footer}}
</body>

<template name="header">
  ... header goes here ...
</template>

<template name="footer">
  ... footer goes here ...
</template>

<template name="main">
  {{> Template.dynamic template=dynamicName}}
</template>

This defines body with header and footer templates, with a dynamic template between. The dynamic template allows you to programmatically choose (at run time) from other templates you have defined.

So, you may have other templates defined for frontPage, catalog and contactUs. Then you set up a template helper for main which returns the actual template name to use in the dynamicName variable:

Template.main.helpers({
  dynamicName: function() {
    var name = some code which selects from 'frontPage', 'catalog` or 'contactUs'
    return name;
  }
});

If name comes from a reactive source, then the selected dynamic template will also change reactively.

Thanks a ton. This should work for me.

How would you select from the different pages. Would you have to manually create a switch statement or something? Thanks

That’s up to you - it’s your code.

How I would I change the name variable to correspond to the name of the page. Can this be automatic? Thanks

Now I’m wondering if you’ve asked the right question, because I’m thinking that what you want to achieve is routing - where changing the URL in the browser address bar changes the page content. There are a few routers for Meteor, notably iron:router and meteorhacks:flow-router.

I’d also recommend checking out some of the excellent Meteor learning resources first: The Official Tutorial, David Turnbull’s Your First Meteor Application, Tom Coleman and Sacha Greif’s Discover Meteor, Aronuda Surisipala’s BulletProof Meteor to name a few.

‘No such template: renderPage’

I get this error. But why won’t iron router add the template in for me. Thanks

Can you show us the code you’re using? It will help us help you.

Well I installed the iron router package and wrote the code as html {{>renderPage}}. Thanks