Overwriting Attribute Values
-
I very much ask you to give me a tip with the formula, since I am not very strong in this.
As a varied example, let’s say I have parameters like this:
<param name=”gender”>Male</param>
<param name=”gender”>Women</param>
<param name=”gender”>Naughty children</param>
<param name=”gender”>dogs and cats</param>I use this formula to write attributes:
[my_map_data_Probnik({param[@name="gender"]})]
function my_map_data_Probnik( $data ) { $map = array( 'Male' => 'For Male', 'Women' => 'For women', ); return ( array_key_exists( $data, $map ) ) ? $map[ $data ] : $data; }
And here’s my question:
How to rewrite this formula to do the following:
If parameter = ‘Male’, then write as ‘For Male’.
If parameter = ‘Women’, then write as ‘For women’.
If the parameter contains the word ‘Children’, then write it as ‘For children’.
If the parameter is different, then do not write anything.I looked at your instructions but couldn’t find a similar example.
I very much ask you to help me, as I cannot write the code on my own.Thank you in advance!
- The topic ‘Overwriting Attribute Values’ is closed to new replies.