View Full Version : Quick question about vBulletin coding and syntax
Tim Skellett
07-16-2009, 07:54 PM
Hi all,
can I use as a variable in a template:
$vbphrase[$thread[prefix_plain]]
In other words, the resultant should look like this when parsed:
$vbphrase[NAME]
where NAME = $thread[prefix_plain]
Or do I need to add quotemarks or something?
Many thanks in advance for all assistance!
Gio~Logist
07-16-2009, 08:01 PM
I have absolutely no no idea what is is you're trying to do. For phrases, the only time you need additional values is when parameters are added.
For example, you'll see a phrase like:{1} has no idea what {2} is talking about
And so in the template I would put <phrase 1="Gio~Logist" 2="Tim Skellet">$vbphrase[no_idea]</phrase>
Hope that helps :p
Tim Skellett
07-16-2009, 08:11 PM
I'll try making it clearer.
I want to call a Phrase from within a template.
Therefore,
$vbphrase[name]
Now, the name of the vbphrase that I want to call up is determined by the variable:
$thread[prefix_plain]
So, I want to know, if I can write in a template:
$vbphrase[$thread[prefix_plain]]
Or if it has to be written differently.
______________
ETA:
Sorry, I used $thread[prefix_rich] in my OP when I meant $thread[prefix_plain]
Paul M
07-16-2009, 08:31 PM
Well the obvious answer is just try it ;)
You may have to put it inside curly brackets i.e. {$vbphrase[$thread[prefix_plain]]}
Tim Skellett
07-16-2009, 08:43 PM
Well the obvious answer is just try it ;)
You may have to put it inside curly brackets i.e. {$vbphrase[$thread[prefix_plain]]}
Thanks, will try it and will keep curlies in mind!
--------------- Added 1247783972 at 1247783972 ---------------
Tried it, in a variety of ways.
Putting the whole statement, as with also the sub-variable, in curly brackets gets vBulletin to accept the statement, otherwise it is rejected as a malformed conditional.
However, while the code is accepted, it does not give any results, in other words nothing at all shows.
IOW:
{$vbphrase[$thread[prefix_plain]]}
will be accepted by the vB, but then results in nothing being displayed for it. Yes, the Phrases are already there to be called upon, so it's not a case of not displaying because of missing stuff.
Any ideas, anyone?
Dismounted
07-17-2009, 06:06 AM
IIRC, vBulletin does not like an array key than it part of an array in templates. It just doesn't work properly.
Marco van Herwaarden
07-17-2009, 08:33 AM
Try: $vbphrase[{$thread[prefix_plain]}]
Tim Skellett
07-17-2009, 06:07 PM
Thanks, but this one also returns "Malformed conditional". Tried it again in a variety of ways, either an empty array or a malformed conditional results.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.