vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Register Option Variables (https://vborg.vbsupport.ru/showthread.php?t=230369)

muratmunich 12-17-2009 07:06 AM

Register Option Variables
 
How to register vbulletin option variables ?

PHP Code:

$myvar=&$vbulletin->options['top_count'];
$templater->register('myvar'$myvar); 

Is there a better way without making a reference to $myvar ?

Maybe Global Product Option Variable Registration ?

Or
PHP Code:

{vb:optionvar top_count


James Birkett 12-17-2009 02:08 PM

You'd think there would be. I'd expect global template variables for $vbulletin->options, vboptions and stylevar at least. I would also expect {vb:user } too.

Do you have to register $vbulletin->options? I would've thought you'd only need to register $vbulletin then any property under it is automatically registered, like with arrays.

Lynne 12-17-2009 03:11 PM

I don't know that you have to register options. Did you try it without registering it?

consolegaming 12-17-2009 05:54 PM

Nah you don't need to register options, stylevar or user variables. I've used them fine in my custom template without any issues. I'm not sure which others are registered globally but I've used those arrays already in my custom templates. So I know for sure they're already globally registered.

Examples of userinfo, options and stylevar variables:

{vb:raw bbuserinfo.username}
{vb:raw vboptions.bburl}
{vb:stylevar imgdir_misc}

muratmunich 12-17-2009 06:01 PM

I am now at work and can't test, but i'll do when i am back at home and tell you then Results.

But what i mean is option variables from other Products and not vbulletin.

Example:
PHP Code:

$vbulletin->options['vbtube_show_lposts'

The Reason i am asking is, i don't want to reference to another Variable if it's possible.
Thought somebody has the same issue and already know a Solution..

This is what i want if possible:
PHP Code:

{vb:raw vboptions.vbtube_show_lposts


consolegaming 12-17-2009 06:13 PM

That should be possible I'd have thought. As what it'll do is select all the same (presumably) options and just load them that way instead so yeah if that was how it was referred to before hand even if it's a custom product I'd say that it should work.

A custom field I added to the user table for example was still stored in the bbuserinfo array.

Hope it works for ya, though it should do.

muratmunich 12-17-2009 06:19 PM

Code is working without a Reference and no Registration.

PHP Code:

{vb:raw vboptions.vbtube_show_lposts

Fine - Thanks...

James Birkett 12-17-2009 07:02 PM

Quote:

Originally Posted by consolegaming (Post 1932390)
Nah you don't need to register options, stylevar or user variables. I've used them fine in my custom template without any issues. I'm not sure which others are registered globally but I've used those arrays already in my custom templates. So I know for sure they're already globally registered.

Examples of userinfo, options and stylevar variables:

{vb:raw bbuserinfo.username}
{vb:raw vboptions.bburl}
{vb:stylevar imgdir_misc}

I thought bbuserinfo could be used as a :var rather than a :raw?

consolegaming 12-17-2009 07:05 PM

Not sure. I just know using it like that worked for me lol. I wasn't even aware of a :var I just copied how they did it in their own templates i.e. in the header template.


All times are GMT. The time now is 05:00 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.01182 seconds
  • Memory Usage 1,736KB
  • 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
  • (9)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