Guest
24 Nov 2016 09:06

Hi, I have a multilevelselect with vales country for level 1 city child and level 2 area child and level 3 street child and level 4

Now i like to have my composite titles generated from a field called name + the area value of the multilevelselect

Lets say name files ID is 2 and field multilevelselect ID is 8

what should I type in the composite title mask

I tried [2]-[8] but this returns the all 4 levels of the multilevelselect field I only need the level3 value

What should be the syntax.

Thank you.

Last Modified: 29 Nov 2016


Sergey
Total posts: 13,748
24 Nov 2016 11:48

This field does nto work in composite title.

Use templates instead.


darkhoros VIP
Total posts: 152
24 Nov 2016 20:54

Hi Sergy, I dont get you, can you elevate on this more. If I try to go with template, how should I pick the 3 level only, do I query the field and implode the values and pick the levels I need only, if so, can you help me with such code please. Thank you.


Sergey
Total posts: 13,748
29 Nov 2016 04:40

You have access to field values through $item->fields_by_id[23]->value. This should have an array where index of array is an ID and value is a text. So your code might look like this.

// list all values
<?php foreach($item->fields_by_id[23]->value AS $val); ?>
    <?php echo $val; ?>
<?php endforeach;?>
// pop last element of array
<?php
$val = array_pop($item->fields_by_id[23]->value);
echo $val;
?>

Or use array_shift to use first element of an array.

Powered by Cobalt