vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Notifications in Navbar (https://vborg.vbsupport.ru/showthread.php?t=296757)

GamerPerfection 04-01-2013 12:48 PM

Notifications in Navbar
 
Is there any way I can get the normal vB notifications (like new PM's etc) to appear in the Navbar instead of the header?

Brandon Sheley 04-01-2013 01:18 PM

You'll need to edit the template, did you purchase or download your style somewhere?
I'd ask there.

GamerPerfection 04-01-2013 02:02 PM

I made the template myself.

kh99 04-01-2013 03:19 PM

When you're rendering your template, register the notification variables to your template, like:
Code:

$templater->register('notifications_menubits', $notifications_menubits);
$templater->register('notifications_total', $notifications_total);


Then look at the original navbar template and copy the parts that display notifications_menubits and notifications_total (unless that's the part you were asking about, in which case this doesn't help :) ).

GamerPerfection 04-01-2013 03:37 PM

That's where I get lost, I don't know anything about rendering. I tried reading this: https://vborg.vbsupport.ru/showthread.php?t=228078 but it loses me very quickly.

kh99 04-01-2013 03:54 PM

OK, when you say you made the template yourself, do you mean that you made a new one called navbar to replace the original? In that case you don't have to worry about the registering, you just need to find the code from the original that mention notifications_menubits and notifications_total, and copy it to your new template.

GamerPerfection 04-01-2013 04:11 PM

Oh sorry, my bad, bad wording. I meant I made the style myself. It is still using the original Navbar template.

kh99 04-01-2013 04:41 PM

Actually, it's my fault - I see now the original question is how you would move it to the navbar from the header. I kind of came in in the middle and got confused.

Anyway, it's the same advice - find the code in the header that displays notifications_total and notifications_menubits, and copy it to your navbar template. As it turns out, those are already registered to the navbar template, so you don't have to worry about that (probably it's left over from vb3 or something). Here's the code from the header template:

Code:

<vb:if condition="$notifications_total">
<li class="popupmenu notifications" id="notifications">
        <a class="popupctrl" href="usercp.php{vb:raw session.sessionurl_q}">{vb:rawphrase your_notifications}: <span class="notifications-number"><strong>{vb:raw notifications_total}</strong></span></a>
        <ul class="popupbody popuphover">
                {vb:raw notifications_menubits}
        </ul>
</li>
<vb:else />
<li class="popupmenu nonotifications" id="nonotifications">
        <a class="popupctrl" href="usercp.php{vb:raw session.sessionurl_q}">{vb:rawphrase your_notifications}</a>
        <ul class="popupbody popuphover">
                <li>{vb:rawphrase no_new_messages}</li>
                <vb:if condition="$show['pmmainlink']"><li><a href="private.php{vb:raw session.sessionurl_q}">{vb:rawphrase inbox}</a></li></vb:if>
        </ul>
</li>
</vb:if>


but that uses <li> tags because it's inside <ul> tags, so if you don't have the same situation in your navbar template then you'll have to do something about that.

GamerPerfection 04-01-2013 04:48 PM

When you say copy it to my navbit template, which template is that? I don't have a navbit, do you mean navbar?

Almost got it working. Just need to figure out how to change the font size and colour as it's using what was in the header.

--------------- Added [DATE]1364840459[/DATE] at [TIME]1364840459[/TIME] ---------------

I believe I have it working now.

http://www.gamerperfection.com/images/notifications.png

The only thing is the font is slightly different from the navbar items. And when there are no notifications the font size is smaller.

kh99 04-01-2013 06:59 PM

navbit was a typo, I meant navbar. If you look at the CSS classes being used in the tags, you could probably figure out the font issue.


All times are GMT. The time now is 04:48 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02015 seconds
  • Memory Usage 1,731KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete