The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Change or Replace Variable!
Hi,
I'm doing my first vbulletin product. and everything seems to be OK as I'm trying to figure out how is everything is working with vbulletin. I came across this issue: (my English is not that good and I'm afraid I won't be able to perfectly explain my issue, so please bear with me ) - I added templates and phrases and plugins. - I added new setting group for my product. - Chose the varname and title and other required things as well. - Then added settings for my products and set if () in it's plugin and everything seems to be fine till now. - then I added other setting with a blank field under the (Option Code) and chose it's varname which is rtrf_xxx_yyy. Now, this varname should be an element of an array. and it should be $vbulletin->options['rtrf_xxx_yyy'] when called, right? I just want to replace or change this variable (array element) and move it's value to a new variable so that I can use the new variable within the templates of my product instead of using $vbulletin->options['rtrf_xxx_yyy'], but I didn't know how to do that! I've tried this in the plugin: PHP Code:
But it works fine if I use {$vbulletin->options['rtrf_xxx_yyy']} within the template. So my question is: - How to replace $vbulletin->options['rtrf_xxx_yyy'] with a variable like $test and be able to use $test in the template that I need and make it shows up where I want in the forum? - Does it matter where the hook is for variable replacement or variable changing? Hope I did well explaining my issue, and hope I can get a fast reply ASAP. thanks |
#2
|
|||
|
|||
anyone?!!!
|
#3
|
||||
|
||||
I'm not sure if I understand what you are asking. I have an array in one of my products called $vbulletin->options[verify_forums]. It is a bunch of forumids. In order to use them in a template, I do the following:
PHP Code:
HTML Code:
<if condition="in_array($threadinfo[forumid], $verifyforums)">
|
#4
|
|||
|
|||
it's somehow similar but not exact.
I'll try again to explain what I'm looking for. I have a variable in one of my product. it's not an array. this variable called $vbulletin->options['rtrf_xxx_yyy'] as it has only one value. not many values as in array. so, I tried to use this variable in a template, in order to do that I did the following: PHP Code:
HTML Code:
<if condition="$test != 0">show something</if> then I tried using the following code: HTML Code:
<if condition="$vbulletin->options['rtrf_xxx_yyy'] != 0"> show something</if> then I tried to put only $test variable in the template to see if it gonna show up. but it didn't. I -then- put $vbulletin->options['rtrf_xxx_yyy'] and it shows me Array['rtrf_xxx_yyy'] then I put {} around the variable like this {$vbulletin->options['rtrf_xxx_yyy']} and it works fine and showes me what I want. I'm just wondering why it did not work when I use $test but work fine when I use {$vbulletin->options['rtrf_xxx_yyy']} although I already set $test value as I mentioned above. $test=$vbulletin->options['rtrf_xxx_yyy']; what I want exactly is to use $test in the template instead of $vbulletin->options['rtrf_xxx_yyy']. but I couldn't make it work or show up. |
#5
|
||||
|
||||
I'm not sure why it isn't working. Perhaps $vbulletin needs to be defined as global in the php code prior to defining $test.
Also, in templates, you should use $vboptions instead of $vbulletin->options. |
#6
|
|||
|
|||
OK Lynne, it finally worked after I changed the hook location.
wasn't sure that does matter specially when I used other codes and variables in the same hook location. thanks for pointing that to me. and thanks for $vboptions thing. that really was helpful. Regards. |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|