Hey guys,
example: a page has one layout with one navigation bar, using Flowrouter for the routing (also using Blaze).
I now want to change the content of the main layout dynamically with Template helpers of the subroutes.
Say I click on link1, then the link1 template will load. Inside the link1 template I have a template helper which changes the content of a div which is only included in the main layout.
Like this:
<template name="myMainLayout">
<div>
<div class="myDiv">{{dynamicText}}</div>
<nav>
<ul class="nav">
<li><a href="{{pathFor 'link1.route'}}">Link 1<a></li>
<li><a href="{{pathFor 'link2.route'}}">Link 2<a></li>
<li><a href="{{pathFor 'link3.route'}}">Link 3<a></li>
<li><a href="{{pathFor 'link4.route'}}">Link 4<a></li>
</ul>
</nav>
{{> Template.dynamic template=main}}
</div>
So when I now have a template for Link 1, can I define the helper for {{dynamicText}}?
If that is not possible, then I could only think of doing the logic inside the myMainLayout template helper, in which I just check the current path and based on the path I change the value of dynamicText. What do you think?
Thanks in advance!