The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
[Solved] variables in settings of product not work
Hello ,
in my product ,i have a textarea setting and print it in a template i try to put a vb variables in this option like this PHP Code:
|
#2
|
|||
|
|||
If you want to allow variables in your setting text, you need to use a plugin to eval() the text before using it in a template. For example:
Code:
eval('$my_setting = "' . $vbulletin->options[my_option] . '";'); Using eval will allow you to use variables in your text. If you also want to use template tags (for example, <if condition=...), then you would need to use the template compiler. |
#3
|
||||
|
||||
Thank you very much kh99 ,
i do this but not worked too i used PHP Code:
PHP Code:
|
#4
|
|||
|
|||
Which hook did you use for your plugin, and which template are you putting the variable in?
|
#5
|
||||
|
||||
Quote:
code : PHP Code:
Thank you again |
#6
|
|||
|
|||
Hmm...OK, try this:
Code:
require_once(DIR . '/includes/functions_misc.php'); eval('$points_pages = "' . replace_template_variables($vbulletin->options[points_pages], true) . '";'); I think the variables $vboptions and $bbuserinfo may be shortcuts that only work templates, so the function replace_template_variables() will replace them with the longer version. (I haven't tried the above code, hopefully there aren't any errors). |
#7
|
||||
|
||||
thnx , kh99
i'm Sorry ... this code not worked too |
#8
|
|||
|
|||
Oh, I didn't notice before, in your code you've done the eval() after the template eval() and it would have to be before. So try this code:
PHP Code:
And use $pointspages in your template (you have $point_pages above - of course you can use either one but make sure it is the same everywhere). |
#9
|
||||
|
||||
yes i know names of variables it not a problem , i take care and sure a bout it
look , i try everything when i used ur code , and i put $vboptions[bbtitle] in setting show me this error PHP Code:
PHP Code:
Thank you for your interest and suggestion! |
#10
|
|||
|
|||
As I mentioned before, your eval for $pointspages must be before the eval for your template. In fact, the function print_output() ends the script and never returns, so anything you put after that will not be executed (which is probably why the error goes away).
I'm trying to do this without trying it myself, so I'm not sure what the issue is. Maybe try this code: PHP Code:
What is the text in your pointpages option? Is the text you posted above what you're using now? I'm asking because if it contains any quote characters that could cause problems. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|