Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by oVox on Dec 04, 2007 08:10
open dhtmlx forum
DHTMLXTree Icons

Hi! Im evaluating Tree, im constructing XML with a Handler PHP page, how do i set icons following the next example?

$records = "Select * from myTable";
do
{
    $contents .= "<item child='" . $Childs .
        "'id='" . $records->fields["MY_ID"] .
        "'text='". $records->fields["NAME"] . "'>" .
        swicht ( $records->fields["TYPE"] )
        {
            A DIFFERENT TYPE OF ICON FOR EACH XML ITEM!!!!
        }
        "<userdata name='" . $records->fields["MY_ID"]."'>" . $records->fields["MY_ID"] . "</userdata></item>";
}
while ($records->movenext() );
echo $contents;
------------------------------------------------------------
Regards, oVox.
Answer posted by Stanislav on Dec 04, 2007 10:03
It will look similar to next

    $contents .= "<item child='" . $Childs .
        "'id='" . $records->fields["MY_ID"] .
        "'text='". $records->fields["NAME"]."'";
        switch ( $records->fields["TYPE"] )
        {
             case "some":
                 $contents.=" im0='customImage1.gif' ";
        }

    $contents .= ">" ;


im0 - image of leaf
im1 - image of closed folder
im2 - image of opened folder
Answer posted by oVox on Dec 04, 2007 11:00

Ok, last question, here is your XML data example:

<!--StartFragment--><?xml version='1.0' encoding='iso-8859-1'?>
<tree id="0">
<item text="My Computer" id="1" child="1" im0="my_cmp.gif" im1="my_cmp.gif" im2="my_cmp.gif" call="true" select="yes">
<userdata name="system">true</userdata>
<item text="Floppy (A:)" id="11" child="0"  im0="flop.gif" im1="flop.gif" im2="flop.gif"/>
<item text="Local Disk (C:)" id="12" child="0"  im0="drv.gif" im1="drv.gif" im2="drv.gif"/>
</item>
<item text="Recycle Bin" id="4" child="0" im0="recyc.gif" im1="recyc.gif" im2="recyc.gif"/>
</tree>

I can't find the property that sets the image path for skins, i want to set the vista style "csh_vista"

Regards, oVox.

Answer posted on Dec 05, 2007 01:36
Actually this parameter can't be set from XML, while init tree you have line similar to next
    tree.setImagePath("../imgs");
the "../imgs" is a path to folder with images used in tree, just point it to necessary one to switch design ( ../imgs/csh_vista or something similar )