variables in attributes

  • Hi,

    as you probally know, a corporate style uses a series of colours. Usually 3 to 5. I want these colours to come appear in the tour in the form of tooltip, bordercolor, fontcolor etc. I was thinking, Instead of filling in 30 attributes of different plugins, scattered over several xml. Is it possible to grab a serie of variables from a global xml and use those colors? That way I could change the whole style of a tour in a few clicks. I now use notepad++ find and replace in all open documents to alter the style.

    global.xml
    <corporatestyle
    color1="0xFFFFFF"
    color2="0x000000"
    />

    then somewhere else:
    <textstyle textcolor="color2" backgroundcolor="color1" />

    <plugin name="locationmark" url="../plugins/textfield.swf" html="[p]Location 1[/p]" css="p{color:color2; font-family:Arial; font-size:12; text-align:right; }" background="false" border="false" height="26" align="bottom right" x="13" y="6" keep="true" />

    Is this possible, and if yes, whats the correct syntax? Alsoo what would you recommend to store the variables in? a empty plugin, a data object or custom object? they need to be carried over to every xml, so it must support keep="true" and im not sure if the data object or custom object cant carried through the next xml with MERGE.

  • Hi guys, this is definetly possible with PHP.

    I've only recently sorted out my wortkflow for panos and I am now going to be getting into the KRpano interface and coding.
    After I saw your post I thought I'd give it a go with PHP.

    I turned the xml file into a php one and and used a PHP variable to control a setting.

    PHP
    <textstyle name="buttonstyle" font="Arial" fontsize="10" border="false" background="false" textcolor="<?php echo $textCol;?>" effect="glow(0x000000,0.7,4,2);dropshadow(2,45,0x000000,3,1);" />


    I set the value of $textCol elsewhere on the page and it works fine. There is no reason why this could not be powered by a database to store the corporate colours for all your clients. All the xml settings could be controlled this way.

    As an example, the link below is powered from a $_GET variable from the address bar and sets the variable $textCol. If you change the colour value at the end and reload the page you will see the text colour of the buttons changes to the colour you used.

    This is not practical in the real world or the URLs would be ridiculous but it is ideally suited from a database.

    http://www.tangent12.co.uk/nn/ibuild/indi…php?tc=0x00ffff

    Give it a try. It's a minor tweak that opens up massive potential. I apologise if I've missed the point entirely here.

    Thanks.

    T12

    Liverpool based panoramic photography, virtual tour and
    web media organisation specialising in high quality web experiences.

  • Hi Jarredja, it is the mouseover text colour. It only sows on the last three buttons. I only made that value dynamic because it was the first colour value in the XML. It could be any xml value.


    Thanks.

    Liverpool based panoramic photography, virtual tour and
    web media organisation specialising in high quality web experiences.

  • so basicly I make 1 php file that I include in every xml?
    colors.php

    PHP
    <?php
     $textCol = "0xFFFFFF"
    ?>


    location1.php:

    PHP
    <include url="colors.php">
    <textstyle name="buttonstyle" font="Arial" fontsize="10" border="false" background="false" textcolor="<?php echo $textCol;?>" effect="glow(0x000000,0.7,4,2);dropshadow(2,45,0x000000,3,1);" />

    And I could load the same way like any other pano?

    Code
    loadpano(location1.php)

    this could solve it. But still wondering if it was possible with just krpano xml coding.

  • Hi Zephyr,

    I've not done enough with KRano yet to even know how you include files and load the pano etc. I am going to be working more from now on because I have got some panoramas to work with.

    I am just used to working with PHP and if you mention reusable variables then PHP is what I would use.


    A lot depends on your deployment too. If you are making panos for your work then there is a good chance that the finished pano could end up on a clients website and you will not always be able to work with a database but you could include a PHP file containing all your variables if you had a lot of different panos.


    Hope this helps.

    Liverpool based panoramic photography, virtual tour and
    web media organisation specialising in high quality web experiences.

  • as you probally know, a corporate style uses a series of colours. Usually 3 to 5. I want these colours to come appear in the tour in the form of tooltip, bordercolor, fontcolor etc. I was thinking, Instead of filling in 30 attributes of different plugins, scattered over several xml. Is it possible to grab a serie of variables from a global xml and use those colors? That way I could change the whole style of a tour in a few clicks. I now use notepad++ find and replace in all open documents to alter the style.

    Hi,

    I understand what you want, but this is currently not possible,

    for <plugins> and <hotspots> you have the <style> element for sharing parameters,
    e.g. to share the "css" settings there, like in this example, see the 3 plugins at the end:
    https://krpano.com/examples/108b8/examples/scenes/scenes.xml

    Alsoo what would you recommend to store the variables in? a empty plugin, a data object or custom object? they need to be carried over to every xml, so it must support keep="true" and im not sure if the data object or custom object cant carried through the next xml with MERGE.

    I would recommend a data, a custom object or a plugin with keep="true",
    all of them will be kept when loading with MERGE,

    best regards,
    Klaus

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!