title: One template for 2 thing MeteorJS
body: <p>I have db with <code>posts</code> and all of them have bollean <code>flagged</code> </p>
  
  <p>I have one template and navigation like (Read, Dont Read).</p>
  
  <p>Problem is that I see all posts (when I must see posts with flagged false or flagged true), and I dont understand why, I think problem in publish/subscribe</p>
  
  <pre><code>Router.configure({
    layoutTemplate: 'layout',
    loadingTemplate: 'loading',
  });
  
  AllPostsController = RouteController.extend({
      template: 'timeTable',
      waitOn: function() {
          return Meteor.subscribe('allPosts');
      }
  });
  
  readPostController = AllPostsController.extend({
    waitOn: function() {
      return Meteor.subscribe('readPosts');
    }
  });
  
  dontreaderPostController = AllPostsController.extend({
    waitOn: function() {
      return Meteor.subscribe('dontreadPosts');
    }
  });
  
  
  Router.map(function() {
    this.route('timeTable', {path: '/',
          controller: AllPostsController
      });
  
    this.route('readPosts', {path: '/read',
          controller: readPostsController
      });
  
    this.route('dontreaderPosts', {
        path: '/dontreader',
        controller: dontreaderPostController
    });
  });
  
  Meteor.publish('allPosts', function(){
      return Posts.find({},{ sort: { createdAt: -1 }});
  });
  Meteor.publish('readPosts', function(){
      return Posts.find({read:true},{ sort: { createdAt: -1 }});
  });
  Meteor.publish('dontreadPosts', function(){
      return Posts.find({read:false},{ sort: { createdAt: -1 }});
  });
  </code></pre>
  
  <p>If someone need more code, Just ask me </p>
  
  <p>Anybody help</p>
  
  <p><strong>EDIT :</strong> David solved problem for regular tasks. Main problem that I have specific <code>return Posts.find(...)</code> in my tamplate helper.</p>
  
  <pre><code>&lt;template name="timeTable"&gt;
          {{#if posts_exist_week}}
            {{&gt; table posts=week}}
          {{/if}}
          {{#if posts_exist_month}}
            {{&gt; table posts=month}}
          {{/if}}
  &lt;/template&gt;
  &lt;template name="table"&gt;
            &lt;table class="main-table table"&gt;
                {{#each posts}}
                  {{&gt; post}}
                {{/each}}
            &lt;/table&gt;
  &lt;/template&gt;
  </code></pre>
  
  <p>You solved my problem <strong>if I did not have</strong> template <code>timeTable</code> (that show posts for last week and month) Because here it <strong>Template helper</strong></p>
  
  <pre><code>Template.timeTable.helpers({
    week: function() {
      //...
      return Posts.find({createdAt: {$gte: weekstart, $lt: yesterday}},{ sort: { createdAt: -1 }}); //return posts that was created in this week
    },
    month: function() {
      //...
      return Posts.find({createdAt: {$gte: monthstart, $lte: weekstart}},{ sort: { createdAt: -1 }}); 
    }
  });
  </code></pre>
  
  <p>And now you see that if I choose your decision (David) I will have <strong>2</strong> !!
  return </p>
  
  <p>first - in router
  second - in template helper</p>