You can register your helpers with handlebars directly. This is what I am using for displaying the current users's email address:
Handlebars.registerHelper('currentUserName', function () {
var user = Meteor.user();
if (_.isUndefined(user) || _.isNull(user)) {
return new Handlebars.SafeString("<i class='icon-spin icon-spinner'></i> Login");
}
return user.emails[0].address;
});
In any template I just call {{currentUserName}}
. For you that'd be
Handlebars.registerHelper('getNodeById', function (id) {
return collection.find({sid:id}).fetch();
});
As a side note: looking at how you want to use it, you might have gotten the idea of Meteor wrong. Meteor is data-driven - don't try to enforce flow-driven paradigms. If you are missing some data in your templates you should change the data-source, not just fetch it in your templates.