The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
PHP / Variable replace numbers with letters
I have a variable named "{vb:raw $steam_info['communityvisibilitystate']}" which is setup as a tab in the members profile. (template, not php)
https://vborg.vbsupport.ru/showthread.php?t=265971 It works great, but it shows up the result '3', rather than a word. In another plugin, I'm using this: PHP Code:
To replace the 3 with a word inside the legacy template with the variable "{vb:raw post.steamicon}". Which is actually working great but the above plugin and the variable in the last line only works in posts seeing it uses $post. Would be great if someone could pinpoint me to the right direction how to make it work inside eg, profiles, tabs, etc. |
#2
|
||||
|
||||
You aren't accessing the word array. The variable you're referring to is $steam_info['communityvisibilitystate'], which is just the state. You actually want to get the corresponding "word" you've associated with the state, specifically $visiblestate_words[$steam_info['communityvisibilitystate']]
|
#3
|
|||
|
|||
Thanks for the reply, appreciate it!
So, in the template I would be using: {vb:raw $visiblestate_words[$steam_info['communityvisibilitystate']]} So I assume, in the php code: PHP Code:
I didn't include: PHP Code:
PHP Code:
if I print_r the $visiblestate_words[$steam_info['communityvisibilitystate']] code, it's working properly (shows green public at the top).. just need to find a way to add this into the template itself. EDIT: If you could give a full example in both template & PHP that work together, would be helpful. I've tried different methods and combinations, can't get it to work. Merely need something that finds template variable made in PHP that functions to search and replace.. that's about it. --------------- Added [DATE]1437205236[/DATE] at [TIME]1437205236[/TIME] --------------- To make it 'simple', as I really need some help.. I have an existing variable $steam_info['communityvisibilitystate'] that I use within templates. which gives either 1,2, or 3 as a result. I merely and simply need an array to replace 1, 2, or 3 with something else.. that's it. |
#4
|
|||
|
|||
Anyone?
|
#5
|
|||
|
|||
I found the answer myself after a long time.. I'm replying here, so hopefully others might find it helpful.
I used "$steam_info['communityvisibilitystate']" to get the info I need, but it came in numbers as you guys are well aware of. So, I've changed the code into: Code:
<vb:if condition="$steam_info['communityvisibilitystate']==1"><font color="red"><b><i>Private</i></b></font></vb:if> |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|