Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 02-01-2005, 09:51 AM
94DROPTOPZ 94DROPTOPZ is offline
 
Join Date: Dec 2003
Location: Arizona
Posts: 68
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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
Reply With Quote
  #2  
Old 02-01-2005, 02:15 PM
ericgtr's Avatar
ericgtr ericgtr is offline
 
Join Date: Apr 2003
Location: Portland, Oregon
Posts: 1,407
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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!
Reply With Quote
  #3  
Old 02-01-2005, 02:21 PM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

you should've done this with the php_include template
Reply With Quote
  #4  
Old 02-01-2005, 02:28 PM
ericgtr's Avatar
ericgtr ericgtr is offline
 
Join Date: Apr 2003
Location: Portland, Oregon
Posts: 1,407
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by sabret00the
you should've done this with the php_include template
Post it up, let's give him some options
Reply With Quote
  #5  
Old 02-01-2005, 04:46 PM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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!
Reply With Quote
  #6  
Old 02-01-2005, 05:31 PM
ericgtr's Avatar
ericgtr ericgtr is offline
 
Join Date: Apr 2003
Location: Portland, Oregon
Posts: 1,407
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #7  
Old 02-01-2005, 09:59 PM
Seiken Seiken is offline
 
Join Date: Sep 2004
Location: Long Island, New York
Posts: 29
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thats cool even though its only one edit. But its conveinent.
Reply With Quote
  #8  
Old 02-01-2005, 10:05 PM
94DROPTOPZ 94DROPTOPZ is offline
 
Join Date: Dec 2003
Location: Arizona
Posts: 68
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you guys very much, I will try this...
Reply With Quote
  #9  
Old 02-02-2005, 11:40 AM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #10  
Old 03-21-2005, 02:18 PM
SGT Rock SGT Rock is offline
 
Join Date: Jan 2003
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:11 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06348 seconds
  • Memory Usage 2,284KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (10)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete