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:
nodebb-widget-essentials/library.js at master · NodeBB/nodebb-widget-essentials
Several basic widgets bundled together in one package including 'HTML', 'Markdown', 'Recent Replies', 'Active Users', and 'Moderators' - nodebb-widget-essentials/library.js at master · NodeBB/nodebb-widget-essentials
GitHub (github.com)