Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 07-31-2002, 09:38 AM
Freestyler's Avatar
Freestyler Freestyler is offline
 
Join Date: Nov 2001
Location: Auckland, New Zealand
Posts: 22
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How to have 'number of new PM's' using a style edit, *not* a template?

Ok, here's something I've been trying to achieve. I have a userbox (that's done through editing the style Header/Footer) that stays at the top of the browser (even when you scroll), and in the userbox I have the following data for the user:

User: username (which is done by using '$bbuserinfo[username]')
Posts: post count (done through '$bbuserinfo[posts]')

Those two both work fine, and display the correct values/info.

However, there's also underneath those two:

Local Time: users local time

and

You have number of new PM's new PM's.

But these two don't seem to want to work. Either I have the wrong variables (so if that's my only problem, please let me know what the variables are !), or there's some other method of displaying such info when editing styles and not templates?

Any help on the issue would be greatly appreciated, those two sets of info are driving me mad!
Reply With Quote
  #2  
Old 07-31-2002, 11:49 AM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

to display user's local time use this:
PHP Code:
vbdate("h:i",time()); 
or
PHP Code:
vbdate($timeformat,time()); 
As for pms: AFAIK it's not a global variable, kept all the time. You have to requery them if you need them, like this:
PHP Code:
$ignoreusers="";
  if (
trim($bbuserinfo['ignorelist'])!="") {
    
$ignoreusers='AND fromuserid<>'.implode(' AND fromuserid<>',explode(' 'trim($bbuserinfo['ignorelist'])));
  }

 
$allpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] $ignoreusers");
  
$newpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] AND dateline>$bbuserinfo[lastvisit] AND folderid=0 $ignoreusers");
  
$unreadpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] AND messageread=0 AND folderid=0 $ignoreusers"); 
Reply With Quote
  #3  
Old 08-01-2002, 03:51 AM
Freestyler's Avatar
Freestyler Freestyler is offline
 
Join Date: Nov 2001
Location: Auckland, New Zealand
Posts: 22
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So how exactly would I go about showing the Local Time and the number of new PM's in the style?

I tried just copy/pasting those above snippets into the style footer where I want them, and the time ones both didn't show anything at all - but the PM chunk (I pasted that whole box of code) spat out all sorts of errors.

I'm most likely missing something really simple, I'm no vB expert
Reply With Quote
  #4  
Old 08-01-2002, 05:29 AM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

These are PHP codes, you can not put them directly inside templates unless you dont want them to be displayed as a code. To parse them you have to put them in .php files. Since you are trying to use them inside header/footer, you may try to put them in global.php for instance. Assign their values in the file, then use the variable in your template.

eg. in global.php use:
$users_date=vbdate("h:i",time());

Then in footer use
$users_date

You can also put them into phpinclude template, it's a template which is parsed..
Reply With Quote
  #5  
Old 08-01-2002, 05:35 AM
Freestyler's Avatar
Freestyler Freestyler is offline
 
Join Date: Nov 2001
Location: Auckland, New Zealand
Posts: 22
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by Logician
You can also put them into phpinclude template, it's a template which is parsed..
Thanks heaps for your help

Are you able to give me more info on how to go about creating one of these phpinclude templates?

All I really need is for the user's local time and their number of new PM's to be displayed in an HTML box which is created in the Footer region of the style.

Would that mean I'd have to make a template with a phpinclude, say a template named 'localtimeandpm', then do '$localtimeandpm' in the footer to make that template show?

Or is it something totally different (I apologise for my knowledge, or lack thereof )?
Reply With Quote
  #6  
Old 08-01-2002, 05:43 AM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

phpinclude template is already exist (check the template list). Just put line

PHP Code:
$users_date=vbdate("h:i",time()); 
in that template, then put

PHP Code:
$users_date 
in your footer and let's see if it works..
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 01:54 PM.


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.04092 seconds
  • Memory Usage 2,226KB
  • Queries Executed 13 (?)
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
  • (5)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)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_postinfo_query
  • fetch_postinfo
  • 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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete