Kodi Community Forum

Full Version: IF Statements (or something along that line)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Here's the issue:

I want to include one of the following

<include>Home_Random</include>
or
<include>Home_Random_Mod</include>

But not both. One is a modified version of mcborzu's IncludesHome_Random.xml file from his new Skin (Amazing BTW).

Anyways, I am trying to setup a Settings Option to select the use of this XML over the other. Changing the <include> is the best way I found how to achieve this however I have no idea how to link the following

<onclick>Skin.ToggleSetting(TV_Shows_Next_Aired)</onclick>

in the settings to the option of which <include> to use.

Can someone help me out or point me in the right direction please?
Kind of confused on what you'd liked, but if I read it right, seems like what you are after is an "include condition" which is sort of like an if/else statement.

The below is an example in Night where I use one to determine whether to launch trailers small or fullscreen based on a settings a user has or has not checked:

PHP Code:
<include condition="!Skin.HasSetting(big_trailer)">ondown_small_trailer</include>
<include 
condition="Skin.HasSetting(big_trailer)">ondown_big_trailer</include> 

What above means is if !Skin.HasSetting(big_trailer) it'll use:
Quote:<include name="ondown_small_trailer">
<ondown>XBMC.PlayMedia($INFO[ListItem.Trailer],1,noresume)</ondown>
</include>

Or skin has Skin.HasSetting(big_trailer) then it'll use:

Quote:<include name="ondown_big_trailer">
<ondown>XBMC.PlayMedia($INFO[ListItem.Trailer],noresume)</ondown>
</include>
Read further... Sad
OK, fixed and all GOOD!!!

Thanks mcborzu!