Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 04-19-2009, 11:46 AM
ScottC2105 ScottC2105 is offline
 
Join Date: Dec 2008
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Using Variables outside vBulletin

I'm having some issues using variables outside vbulletin. For the username I'm using $vbulletin->userinfo['username'] which is fine. Now, for notifications I'm using $notifications_total which works outside of vBulletin but for some reason this variable doesn't work when I include a php file in the header of vBulletin it is just "blank".

Is there anyway around this? Also, I am using $pmbox['lastvisitdate'] to show the last time a user visited outside vBulletin which, again, is fine but again, on vBulletin it is "blank".

Can anyone help me with this?

Thanks very much!
Reply With Quote
  #2  
Old 04-19-2009, 12:12 PM
snakes1100 snakes1100 is offline
 
Join Date: Dec 2001
Location: Michigan
Posts: 3,733
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You would get a better and most likely a faster answer by posting in the right forum.

https://vborg.vbsupport.ru/forumdisplay.php?f=15
Reply With Quote
  #3  
Old 04-19-2009, 12:13 PM
ScottC2105 ScottC2105 is offline
 
Join Date: Dec 2008
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by snakes1100 View Post
You would get a better and most likely a faster answer by posting in the right forum.

https://vborg.vbsupport.ru/forumdisplay.php?f=15
Could someone move this then please?
Reply With Quote
  #4  
Old 04-19-2009, 03:35 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Moved to Programming Discussions.

I don't understand when you say you are using things "outside vbulletin". Did you create some new page for your site? And did you include global.php at all? Did you follow something like this article - [How-To] vBulletin API Basics: Creating Custom Pages & Misc. You can only use a variable if it's been defined. And some variables are only defined for some specific pages. So, you would need to include the code in your page in order to use some of them.
Reply With Quote
  #5  
Old 04-19-2009, 07:03 PM
ScottC2105 ScottC2105 is offline
 
Join Date: Dec 2008
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
Moved to Programming Discussions.

I don't understand when you say you are using things "outside vbulletin". Did you create some new page for your site? And did you include global.php at all? Did you follow something like this article - [How-To] vBulletin API Basics: Creating Custom Pages & Misc. You can only use a variable if it's been defined. And some variables are only defined for some specific pages. So, you would need to include the code in your page in order to use some of them.
Right I have managed to do it. Now I need to get the first post from threads in one particular forum that i am using for news, limit it to 500 characters and show it on my homepage. Maximum of 10 posts. Any idea where I start?
Reply With Quote
  #6  
Old 04-19-2009, 08:09 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Start by searching for a modification that does something similar to what you want and then modifying it to do what you need. Or, find a the queries in the existing vb code and modify it to do what you want.
Reply With Quote
  #7  
Old 04-19-2009, 11:04 PM
ScottC2105 ScottC2105 is offline
 
Join Date: Dec 2008
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've been looking everywhere. I just can't seem to get $notifications_total to work in the header template of my vbulletin skin. $notifications_total works outside vbulletin now but not in the healer of my skin.
Reply With Quote
  #8  
Old 04-20-2009, 12:08 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I would guess it hasn't been defined prior to you evaling your header template. It's too hard to tell with such vague descriptions of what you have done.
Reply With Quote
  #9  
Old 04-20-2009, 12:12 AM
ScottC2105 ScottC2105 is offline
 
Join Date: Dec 2008
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
I would guess it hasn't been defined prior to you evaling your header template. It's too hard to tell with such vague descriptions of what you have done.
I have moved the notifications_total code to my header template on my vbulletin skin and as you said I dont think it has been defined yet. Is there anyway around this?
Reply With Quote
  #10  
Old 04-20-2009, 12:15 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The way around it is to move the code to a spot prior to the header being evaled, or move the notifications back to the navbar template.
Reply With Quote
Reply

Thread Tools
Display Modes

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 10:05 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.05441 seconds
  • Memory Usage 2,248KB
  • 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
  • (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