How to modify rendering template ?
-
I set a new field by using
topics.setTopicField(tid, 'status', 1, callback)
in each topic.this's a piece of code in original
topic.tpl
<span class="topic-title" component="topic/title">{title}</span>
And I want to add a html snippet before this code like bellowed:
<!-- IF status == 1 --> <span class="default">something</span> <!-- END status --> <span class="topic-title" component="topic/title">{title}</span>
How could I do this ? Many thanks!
-
<!-- IF status --> code <!-- ENDIF status -->
?
-
@psychobunny
I want to check topic's status against number since it's a integer value.But my question is how to add that snippet into rendering template in my plugin ?
-
If you need complex logic in your templates then check out helpers, here's a link to get you started:
how to create and use a template helper
Building a custom theme based on vanilla: I want to show the posts.index for each post in the topic.tpl template The problem is that the first post is, obvio...
NodeBB Community (community.nodebb.org)
-
@psychobunny thanks! that's really helpful
Copyright © 2024 NodeBB | Contributors