vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Number of new posts in navbar? (https://vborg.vbsupport.ru/showthread.php?t=75539)

94DROPTOPZ 02-01-2005 09:51 AM

Number of new posts in navbar?
 
I'm sure that this is pretty simple for some of you and I have messed with it a bit and can't seem to get it to work. What I'm looking to do is add the number of new posts next to the "New Posts" link in the nav bar, just so before they click the new posts they have an idea of how many new posts there are. I saw this on another site and I think that it's a good idea.

I have seen Garys "hack" but it's really not what I'm looking for right now...

Thanks in advance for your help

ericgtr 02-01-2005 02:15 PM

Here you go, this query is compliments of vBadvanced.

In your vbroot/index.php find:

PHP Code:

// ### ALL DONE! SPIT OUT THE HTML AND LET'S GET OUTA HERE... ### 

Add this just above it:

PHP Code:

//New Posts
        
$getnewposts $DB_site->query_first("SELECT COUNT(*) AS count FROM " TABLE_PREFIX "post WHERE dateline >= '$bbuserinfo[lastvisit]'");
        
$newposts number_format($getnewposts['count']);
//New Posts 

In your navbar template find:

PHP Code:

<td class="vbmenu_control"><a href="search.php?$session[sessionurl]do=getnew" accesskey="2">$vbphrase[new_posts_nav]</a></td

Replace it with:

PHP Code:

<td class="vbmenu_control"><a href="search.php?$session[sessionurl]do=getnew" accesskey="2">$vbphrase[new_posts_nav]</a> ($newposts new)</td

That's it! :)

sabret00the 02-01-2005 02:21 PM

you should've done this with the php_include template ;)

ericgtr 02-01-2005 02:28 PM

Quote:

Originally Posted by sabret00the
you should've done this with the php_include template ;)

Post it up, let's give him some options :)

sabret00the 02-01-2005 04:46 PM

add to your phpinclude_start
PHP Code:

//New Posts
        
$getnewposts =$DB_site->query_first("SELECT COUNT(*) AS count FROM " .TABLE_PREFIX "post WHERE dateline >= '$bbuserinfo[lastvisit]'");
        
$newposts number_format($getnewposts['count']);
//New Posts 

In your navbar template find:

PHP Code:

<td class="vbmenu_control"><ahref="search.php?$session[sessionurl]do=getnew"accesskey="2">$vbphrase[new_posts_nav]</a></td

Replace it with:

PHP Code:

<td class="vbmenu_control"><ahref="search.php?$session[sessionurl]do=getnew"accesskey="2">$vbphrase[new_posts_nav]</a> ($newpostsnew)</td

That's it! :)

ericgtr 02-01-2005 05:31 PM

Quote:

Originally Posted by sabret00the
add to your phpinclude_start
PHP Code:

//New Posts
        
$getnewposts =$DB_site->query_first("SELECT COUNT(*) AS count FROM " .TABLE_PREFIX "post WHERE dateline >= '$bbuserinfo[lastvisit]'");
        
$newposts number_format($getnewposts['count']);
//New Posts 

In your navbar template find:

PHP Code:

<td class="vbmenu_control"><ahref="search.php?$session[sessionurl]do=getnew"accesskey="2">$vbphrase[new_posts_nav]</a></td

Replace it with:

PHP Code:

<td class="vbmenu_control"><ahref="search.php?$session[sessionurl]do=getnew"accesskey="2">$vbphrase[new_posts_nav]</a> ($newpostsnew)</td

That's it! :)

Cool, so this will add the query anywhere on the site regardless if the navbar is on the page or not? I realize most pages have it anyway but I am wondering about overhead.

Seiken 02-01-2005 09:59 PM

Thats cool even though its only one edit. But its conveinent.

94DROPTOPZ 02-01-2005 10:05 PM

Thank you guys very much, I will try this...

sabret00the 02-02-2005 11:40 AM

Quote:

Originally Posted by ericgtr
Cool, so this will add the query anywhere on the site regardless if the navbar is on the page or not? I realize most pages have it anyway but I am wondering about overhead.

yup one query to everypage, not sure how worth it, it is, but it's not alot and won't every bring the server to it's needs or nothing of the sort.

SGT Rock 03-21-2005 02:18 PM

All I get is a set of parenthesis without a number: ()


All times are GMT. The time now is 10:06 AM.

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.01237 seconds
  • Memory Usage 1,762KB
  • 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
  • (10)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete