The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
notifications_total in FORUMHOME
I'm trying to display $notifications_total in the FORUMHOME template ({vb:raw notifications_total} but without success whereas the same variable works fine elsewhere.
I assume my issue is that $notifications_total isn't a global variable in which case what can I do? Thanks for any assistance. |
#2
|
||||
|
||||
Try:
Code:
{vb:raw notifications_total} |
#3
|
||||
|
||||
Thanks Boofo but I've tried that. Typo in the top post.
|
#4
|
||||
|
||||
The it must not be available on the forumhome. You might need to do a query for it.
|
#5
|
||||
|
||||
I've come up with the below which works on FORUMHOME and SHOWTHREAD.
I want to use this in a lot of templates so would it be better to make it a global variable (if that's possible) or should I just create a long list of preRegisters? PHP Code:
|
#6
|
||||
|
||||
Where are you trying to use this?
|
#7
|
||||
|
||||
I'm trying to get the total number of notifications into the page title in a similar way to Twitter or Facebook. E.g. "(4) vBulletin.org Forum".
|
#8
|
||||
|
||||
I don't use Twitter or Facebook so I have no idea how they do things. Where are you wanting this to show up exactly?
|
#9
|
||||
|
||||
Sorry I'll try to explain better.
I want to add the total number of notifications to HTML page title. Like this: So in the template something like this (variables are from memory): HTML Code:
<title>({vb:raw notifications_total}) {vb:raw bboptions:title}</title> Thanks |
#10
|
|||
|
|||
I don't think you need to do a query because the global $notifications_total should contain the total (assuming it's been calculated at the point you're trying to use it, of course), but it has to be registered to the template(s) where you want to use it. If you create a plugin using hook process_templates_complete you should be able to do preRegisters there. (process_templates_complete was just added a couple versions ago so it's possible you don't have it if you're not up to date).
You would have to register it to each template as I don't think there's any way to globally register to all templates. But there is a number of globals that *are* registered automatically in each template, so you could piggy back on one of those. For instance, $vbulletin->userinfo is registered as bbuserinfo, so in your plugin you could set $vbulletin->userinfo['notifications_total'] = $notifications_total then use {vb:raw bbuserinfo.notifications_total} in each template. (Probably some people will tell you that you shouldn't really do it this way, but I don't see a problem with it). |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|