PDA

View Full Version : vbphrase inside vbphrase is not possible


emtee
06-14-2006, 05:32 AM
Hi,

I want to have $vbphrase[my_phrase_$DynamicValue] but it's not possible, so I tried to put a $vbphrase inside a parent $vbphrase but it's not possible either. Any workaround for this issue beside using if condition because 100 if conditions certainly don't look good and it can kill your server (evaluate and process hundreds of if conditions)

Example: I have a drop down select box with short description and long description for car makers. Short description is VW and long is VoltsWagen. For main page, because space is limited so I just want VW displayed instead of VoltsWagen, and since only 1 value VW is saved to the column, when I want to display long description VoltsWagen, I use

<if condition="$info[carmaker] == VW">$vbphrase[carmaker_VW]</if>

(of course I have a phrase carmaker_VW contains value VoltsWagen)

which works fine, but I don't like it because if you have hundreds of carmakers (or for other data) then you have to use hundreds if conditions. I don't like having hundreds of if conditions just in 1 template

So I really want something like this: $vbphrase[carmaker_$info[carmaker]]

or $vbphrase[carmaker_$vbphrase[carmaker_VW]]

I also tried <phrase 1="$info[carmaker]">$vbphrase[maker_]</phrase> with a phrase maker_ contains value maker_{1} but it don't work either.



Any help is greatly appreciated!

Alan @ CIT
06-14-2006, 05:47 AM
In your PHP script, try:

$make = $vbphrase['carmaker_' . $info['carmaker']];

See if that works.

Thanks,
Alan.

emtee
06-15-2006, 12:12 AM
I'm trying to do it in templates only though. If it's impossible to do in templates then I'll add it to my PHP script.

Thanks Alan for helping! :)

Adrian Schneider
06-15-2006, 02:31 AM
Use {$vbphrase['carmaker_' . $info['carmaker']]} in your template.

emtee
06-15-2006, 04:01 AM
SirAdrian,
It works! Thank you very much! :banana: