Getting variables (eg total post count, etc)
-
Hey! Another one of these threads (sorry!).
I was wondering if there was any way to get variables like total post count, topic count, users online, etc, through templates? I'm using 0.6.0, since I can't upgrade (due to my theme), and I believe you used to be able to use
{global.postCount}
,{global.topics}
, etc. Could anyone point me in the right direction?Thanks in advance!
-
You'd have to add a library.js file to your theme and add some server side methods to get it. You'd probably want to do a socket call to this method and then render it via JS. Here's how we do it for widgets:
https://github.com/NodeBB/nodebb-widget-essentials/blob/master/library.js#L152-L179
Copyright © 2024 NodeBB | Contributors