The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
It's this a suicidal code?: Maybe I'm going to kill my own DB
This is the code...
Code:
<if condition="$post['field18'] == 'TEXT-'"> CODE A <else /> <if condition="$post['field18'] == 'TEXT-B'"> CODE B <else /> <if condition="$post['field18'] == 'TEXT-C'"> CODE C <else /> <if condition="$post['field18'] == 'CODED'"> CODE D <else /> ...... When I first think of this...well, I think it'll make only one DB call for $post['field18'], and then compare the results with the IF possibilities. But maybe not. If I do this...I'm cutting my own throat? O o'' (If it's one db call for every one posibility....YES IT IS ) Maybe it's too obvious, but...well....I need to know it Sorry! And thanks! |
#2
|
||||
|
||||
While I"m sure there is a better way to do whatever your trying to do... that code will not break anything.
You cannot execute queries from the template, you can only access variables that have already been created by the script. The array $post already includes all of the values for that array including $post['field18']. The query that populates that array will be executed whether or not you use the variable $post['field18'] in the template. |
#3
|
||||
|
||||
Use a SWITCH instead of 50 IF statements. Use this in a plugin of course, as it's PHP.
Example: PHP Code:
|
#4
|
||||
|
||||
Use Wired1's method, and assign your data to a variable. Use that variable in your template.
|
#5
|
||||
|
||||
Thank you very much! ^ ^
You know when you don't understand what happening, and starts to doubt about everything? ¬ ¬ Well, at least I'll never going to doubt about it again. |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|