vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Using Variables outside vBulletin (https://vborg.vbsupport.ru/showthread.php?t=211626)

ScottC2105 04-19-2009 11:46 AM

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!

snakes1100 04-19-2009 12:12 PM

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

ScottC2105 04-19-2009 12:13 PM

Quote:

Originally Posted by snakes1100 (Post 1794381)
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?

Lynne 04-19-2009 03:35 PM

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.

ScottC2105 04-19-2009 07:03 PM

Quote:

Originally Posted by Lynne (Post 1794480)
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?

Lynne 04-19-2009 08:09 PM

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.

ScottC2105 04-19-2009 11:04 PM

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.

Lynne 04-20-2009 12:08 AM

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.

ScottC2105 04-20-2009 12:12 AM

Quote:

Originally Posted by Lynne (Post 1794824)
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?

Lynne 04-20-2009 12:15 AM

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.


All times are GMT. The time now is 03:05 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.01443 seconds
  • Memory Usage 1,737KB
  • 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
  • (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