vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   How to have 'number of new PM's' using a style edit, *not* a template? (https://vborg.vbsupport.ru/showthread.php?t=41731)

Freestyler 07-31-2002 09:38 AM

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!

Logician 07-31-2002 11:49 AM

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"); 


Freestyler 08-01-2002 03:51 AM

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 :)

Logician 08-01-2002 05:29 AM

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..

Freestyler 08-01-2002 05:35 AM

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 ;))?

Logician 08-01-2002 05:43 AM

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..


All times are GMT. The time now is 12:35 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.01111 seconds
  • Memory Usage 1,738KB
  • 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
  • (5)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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