Hello !
Which is the simplest way to get 'isSection' and 'link' properties of categories to render 'account/categories' pages ? I need them for my account/categories.tpl template.
Thanks in advance for help !
{{{ if your_condition }}}
<span>HTML stuff you only want displayed under 'condition'</span>
{{{ end }}}
Then you have to set your_condition
as a property of the data object when calling res.render
:
res.render('template', {
your_condition: req.path === 'targetted_path',
});
Just as example, might not actually work.
//map.tpl
<ul class="nav nav-pills">
<li><a href="{config.relative_path}/map?section=section1">[[map:A]]</a></li>
<li><a href="{config.relative_path}/map?section=section2">[[map:B]]</a></li>
</ul>
{{{ if my_condition }}}
<span>
<p>Some Text</p>
<input type="text" class="form-control input-lg" placeholder="Search"/>
</span>
{{{ end }}}
//In the plugin's controllers.js
console.log(nconf.get('relative_path')); //returns undefined
console.log(req.path); //returns /api/map
In fact I was expecting req.path should equal to http://localhost:4567/map?section=A
.. but it is returning req.path equal to /api/map
Thank you very much
//map.tpl
<ul class="nav nav-pills">
<li><a href="{config.relative_path}/map?section=section1">[[map:A]]</a></li>
<li><a href="{config.relative_path}/map?section=section2">[[map:B]]</a></li>
</ul>
{{{ if my_condition }}}
<span>
<p>Some Text</p>
<input type="text" class="form-control input-lg" placeholder="Search"/>
</span>
{{{ end }}}
//In the plugin's controllers.js
console.log(nconf.get('relative_path')); //returns undefined
console.log(req.path); //returns /api/map
In fact I was expecting req.path should equal to http://localhost:4567/map?section=A
.. but it is returning req.path equal to /api/map
Oh actually in that case you should be able to use req.query.section
I think.