did it today...maybe nodebb is able to fix it
Solved display different things in theme
-
can someone explain for beginner how to display different things in a theme?
for example in this post https://community.nodebb.org/topic/8328/display-different-things-in-theme
what do you need to write to simply display the post timestamp or the user's signature?
-
I clicked your link twice thinking I was going down some sort of link rabbit hole. Signature is enabled in the ACP.
-
@a_5mith i should make it more clear.
how to display them using code? i see things like {posts.editedISO} so is that how to display different things? if so how do i know and where do i find those things? is there a guide to learn from?
-
@charles I usually just add
/api
to the beginning of the url for the page you are trying to edit. It will give you a json object, which is what the {posts.editedISO} is referring to. For example, https://community.nodebb.org/api/topic/8328/display-different-things-in-theme/2Advanced: You can also add any data to that object using the controller hook for that page, e.g. https://github.com/NodeBB/NodeBB/blob/master/src/controllers/topics.js#L290 and editing the templateData.
-
@yariplus using your example, let's say I want to display the content and then the person that posted that content.
would it be
{content}
and{username}
?
and can I put in that in any file? -
@charles In my example,
posts
is an array, so it would need to be:<!-- BEGIN posts --> {posts.username} {posts.content} <!-- END posts -->
-
@yariplus trying out the code you provided, I was able to display {posts.content} but {posts.username} is not working.
-
@charles it's
{posts.user.username}
-
@pichalite @yariplus thank you both!