PDA

View Full Version : Register Option Variables


muratmunich
17 Dec 2009, 08:06
How to register vbulletin option variables ?

$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 {vb:optionvar top_count}

James Birkett
17 Dec 2009, 15:08
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
17 Dec 2009, 16:11
I don't know that you have to register options. Did you try it without registering it?

consolegaming
17 Dec 2009, 18:54
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
17 Dec 2009, 19:01
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:

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

{vb:raw vboptions.vbtube_show_lposts}

consolegaming
17 Dec 2009, 19:13
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
17 Dec 2009, 19:19
Code is working without a Reference and no Registration.


{vb:raw vboptions.vbtube_show_lposts}

Fine - Thanks...

James Birkett
17 Dec 2009, 20:02
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
17 Dec 2009, 20:05
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.