IF action different xml files

  • Hi there,
    I have a problem with IF action when I use this:

    Code
    <action name="ifpluginintro1">
    if(plugin[pluginintro1] !== null, action(pluginintro1););
    </action>

    as I can understand it checks if this plugin exists in the same xml document.

    But it didn't work when I have this:


    Code
    <krpano version="1.0.8">
    <include url="skin.xml" />
    <include url="intro.xml" />
    </krpano>

    and the condition is in skin.xml, but the plugin is in intro.xml

    I use one skin xml file for all panos, but some panos needs extras like intro. I want just to add actions in onxmlcomplete and onloadcomplete when I use intro.xml.

    I tried this:

    Code
    <krpano version="1.0.8">
    <include url="skin.xml" />
    <include url="intro.xml" />
    </krpano>

    skin.xml:

    Code
    <events onxmlcomplete="action(ifpluginintro1);"/>
    <events onloadcomplete="action(ifpluginintro2);" />
    
    
    <action name="ifpluginintro1">
    if(plugin[pluginintro1] !== null, action(pluginintro1););
    </action>
    <action name="ifpluginintro2">
    if(plugin[pluginintro2] !== null, action(pluginintro2););
    </action>

    intro.xml:

    Code
    <krpano version="1.0.8">
    <action name="pluginintro1">
     ...
    </action>
     
    <action name="pluginintro2">
     ...
    </action>
    </krpano>

    But as I said it checks if there is such plugin in skin.xml.

    When I don't use condition in skin.xml :

    Code
    <events onxmlcomplete="action(pluginintro1);"/>
    <events onloadcomplete="action(pluginintro2);" />

    It works fine when the pano uses intro.xml,
    but it returns me errors if there is no intro.xml

    May be the easiest way is just to suppress the error messages somehow...

    What would you suggest me?

  • Hi,

    do you have a the "onxmlcomplete" events in each included xml?
    that's not possible, there can be only one <events> tags,

    suppressing errors would be possible via:

    Code
    <krpano ... showerrors="false">

    best regards,
    Klaus

  • No, I don't have "onxmlcomplete" events in each included xml. I know that it will be overwritten. But I have action that is in other xml.

    This is the basic skin xml

    Code
    <events onxmlcomplete="action(ifpluginintro1);"/>
    
    
    <action name="ifpluginintro1">
    if(plugin[pluginintro1] !== null, action(pluginintro1););
    </action>

    I want to check if there is a pluginintro1 in intro.xml then to run the action pluginintro1

    2 Mal editiert, zuletzt von bg360 (28. Juli 2010 um 19:55)

  • Hi,

    do you want to check if there is a <plugin> named "pluginintro1"?
    in this case your code is right,

    or do you want to check if there is a <action> named "pluginintro1"?
    in this case you need check for the action:
    if(action[pluginintro1] !== null, action(pluginintro1););

    best regards,
    Klaus

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!