Customizing SMF > SMF Coding Discussion
Undefined index...what did I do wrong? lol
(1/1)
Jade Elizabeth:
I'm using $context['num_users_online'] in my index template...and getting errors, also it doesn't work everywhere. Did I forget to global something? For future reference, if I did how do I figure out what? ;D
Arantor:
It's in $context because the board index code puts it there after a database query. Look in BoardIndex.php for the reference to getting the number of users.
It's an extra (not especially cheap) query per page you want to use it on.
Jade Elizabeth:
Yeah it only works on the boardindex...how do I get it to work on every page? :)
Arantor:
Find the code in the board index handler and slow your entire site down by running that extra query every page...
Jade Elizabeth:
Okay sweet! Done :D
Danke!
Navigation
[0] Message Index
Go to full version