How can I update layout template variable?


#1

I have a index template, wich include main and yield. I want to update main, when the different yield are updating. How can I do this?
< template name=“index”>
{{> main}}
{{> yield }}
</ template>


#2

I suppose this question is related to iron:router, right?

If so, you can just use different layouts for different routes.

This atricle explains it quite well I think:

#Example

Your Content Templates (or Pages)

Content Template 1:

<template name="index">
    <h1>Some Content</h1>
</template>

Content Template 1:

<template name="secondPage">
    <h1>Some other content</h1>
</template>

###Your Layout Templates

Layout 1:

<template name="main">
    {{> main}}
    {{> yield }}
</template>

Layout 2:

<template name="second">
    {{> second}}
    {{> yield }}
</template>

###Your routes:

Router.configure({
  // the default layout
  layoutTemplate: 'main'
});
 
Router.route('/', function () {
  this.render('index');
  this.layout('main');
});
 
 
Router.route('/second', function () {
  this.render('secondPage');
  this.layout('second');
});

Hope this helps.