Kodi Community Forum

Full Version: return variable back to parameter
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm trying to figure a way (or a way around) to pass a parameter back to a variable.

Simplification of what I am trying to do:

I have a label control in a container template:

PHP Code:
<param name="ID"/>
...
<
definition>
     <
label>$INFO[Container($PARAM[ID]).ListItem(0).Label]</label>
</
definition

So the include this is part of is reused several times and the container differs every time.

However, the above doesn't suffice. The label needs to have different info depending on a property set elsewhere.

So what I would like to do is:

PHP Code:
<label>$VAR[InfoLabel]</label

and get the value from the variable as in this example:

PHP Code:
<variable name="InfoLabel">
     <
value condition="StringCompare(Container(9000).ListItem.Property(widget),movies">$INFO[Container($PARAM[ID]).ListItem(0).Title]</value>
     <
value condition="StringCompare(Container(9000).ListItem.Property(widget),music">$INFO[Container($PARAM[ID]).ListItem(0).Artist]</value>    
     .. 

ID 9000 is a different container from the one that needs to display the info.

But this will not work. Probably because the variable is not "aware" of the parameters set.

Any ideas anyone? Hopefully the above is somewhat clearly explained.
long shot (untested):
Code:
<param name="ID"/>
    <variable name="InfoLabel">
        <value condition="StringCompare(Container(9000).ListItem.Property(widget),movies">$INFO[Container($PARAM[ID]).ListItem(0).Title]</value>
        <value condition="StringCompare(Container(9000).ListItem.Property(widget),music">$INFO[Container($PARAM[ID]).ListItem(0).Artist]</value>
    </variable>

    <control type="label">
        <label>$VAR[InfoLabel]</label>
    </control>
</param>
Good idea, removed the first closing of the parameter but unfortunately I haven't been able to get it to work.