Is conditional include using $PARAM as condition possible?
#1
Hi,

Wanting to reuse a menu-layout, but with different items. And thought using $PARAM was the clever way to do it.

My goal is to determine if two predefined constant text strings are equal

My skin XML is like this:

In each xml where I want my sidemenu:

Code:
<include name="menuItems">
    <param name="subMenu">settings</param>
</include>

And in the <includes>:

Code:
<include name="menuItems">
        <param name="subMenu" default="X"/>
        <definition>
        ... (layout stuff)..
       <include condition="Stringcompare($PARAM[subMenu],settings)">itemsForSettings</include>
        ...(layout stuff somemore)

.. but the Stringcompare part never becomes true.

The Layout and include condition workes nicely for other conditions; eg. Window.isactive(videolibrary). The parameter "subMenu" is passed nicely and shows fine in a label.

I do notice that the string functions mentioned on the wiki on bools says "info" as the first parameter. So perhaps another function that actually compares strings is what I need?

Why I suddenly needed more control than window.isactive is because of the settings windows. There are many, and I donøt want to check for lots of windows when I can simply choose what to display using a $PARAM. Should be a faster run that way?

Thanks, Smile

p.s. I wish I could hilite code inside the &lt;pre&gt; tag for even faster readability.
Reply
#2
I'm using $PARAM a lot but as far as I know, this StringCompare thing works when it's part of something ex :

Code:
Stringcompare(Container($PARAM[Id]).MyInfoLabel,MyValue)

But I also tried yours which never worked so I would say that using it alone doesn't work.
What I did for my menu was to call the complete list of the whole built-in controls and applied conditional visibilities to them like Control.IsEnabled or Window.IsVisible if some have the same Ids.

EDIT : What I didn't try is the substring :

Code:
SubString($PARAM[subMenu],EndOfMyValue1)
SubString($PARAM[subMenu],EndOfMyValue2)
...
[Skin] KOver - V1.1.0 Stable (Repo version)
[WIP] ReKOver - Skinning tool project

If I've been helpful or you like my work, hit "THANK USER" button ;) ...
Reply
#3
Hi Jayz2k,

I believe the visible tag is evaluated each frame, so I would like to stay clear of those if at all possible.
I have an idea to try to use a number comparison in stead. Afk atm.
Reply
#4
You could also use <include>$PARAM[include_name]</include>, that definitely works on my end.
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#5
Works like a charm. That would be the clever way of doing what I need done! Thanks a bunch! Smile
Reply
#6
..It seems I'd still like to be able to "filter" on $PARAM in includes actually.. perhaps

Like:

Code:
<include definition..
   <include because $SAMEPARAM".. add animation
   <include skip this because $SAMEPARAM.. skip a block
   <include because $SAMEPARAM.. skip a block
   ...
</include>

Because on occasion I need to add odd bits and pieces to a big include, and if I could filter on the allready passed $PARAM, it would be easy to, say, include an animation block or what have you. But for now I bend what phil65 teached me and have simply added more $PARAMs to control those cases by passing empty $PARAMs to be used as the INCLUDE name.

Code:
(pseudo)
<include BLOCK, but set Param A=""

<include name="BLOCK"...
    <Param "A" defaults to "show animation always"...
    <Param "B" defaults to "show on left side"...
    <include name=param A..
    <include name=param B..

But I don't really need more params being passed for the filtering of code blocks.

Hmm.. writing and thinking.. The latter is definitly more readable.. - heh. Yeah,
Param overrideAnimation="" is definitly easier to read and more transparent than handling it all internally in one include.

.. I seem to have run out of reasons to wish for $PARAM as condition in include tags? Anyone?! Tongue
Reply

Logout Mark Read Team Forum Stats Members Help
Is conditional include using $PARAM as condition possible?0