What next to achieve collapsable style?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cleary1981
    New Member
    • Jun 2008
    • 178

    What next to achieve collapsable style?

    Hi,

    I am using php to generate an xml file with information from my database. What I want to do is style xml into an expandable collapsable table where the user will only see the childnodes if they click on the parent node.


    Code:
    <?xml-stylesheet href='completeproject.css' type='text/css'?> 
    <companies>
    	<company id='PORTASILO'>
    	<project id='00001'>
    		<project_name>LAFARGE</project_name>
    	</project>
    	<project id='00003'>
    		<project_name>PATRICKSWELL</project_name>
    	</project>
    	<project id='00004'>
    		<project_name>TP033</project_name>
    	<panel>
    		<panel_name>PANELB</panel_name>
    	</panel>
    	</project>
    	</company>
    	<company id='BI WATER'>
    	<project id='00002'>
    		<project_name>LEE TUNNEL</project_name>
    	</project>
    	<project id='00005'>
    		<project_name>TP34</project_name>
    	<panel>
    		<panel_name>PANELA</panel_name>
    		<status>Complete</status>
    	</panel>
    	</project>
    	</company>
    	</companies>
    completeproject .css
    Code:
    companies company project project_name{
    background-color:#538620;  
        border-bottom-width:0;  
        color:#FFF;   
        font-size:110%;  
        font-weight:bold;  
        margin:0;  
        padding:0.3em 0.5em;
        display:block;   
    }  
    companies company project panel panel_name{
    	background-color:gray;
    	color:white;
    	display:block; 
    	padding:0.3em 0.9em;
    
    }
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    if you want something onclick it sounds like a javascript task (ccs can't do that), maybe you want to transform your xml into a html file to get a userfriendly display (xml is not designed to be displayed or layouted).

    regards

    Comment

    • Frinavale
      Recognized Expert Expert
      • Oct 2006
      • 9749

      #3
      I've moved your question to the php forum.

      It seems to me that you are going to have to generate HTML using PHP that displays the XML file in a table. From there you are going to have to apply JavaScript that controls the collapsing of the table.

      Your first step should be generating the HTML that displays your XML file in the table.

      After you have that working and displaying properly you can attempt the JavaScript portion of your application that will control collapsing and expanding of the table.

      -Frinny

      Comment

      • nathj
        Recognized Expert Contributor
        • May 2007
        • 937

        #4
        I've seen cases where XML is displayed to the browser direct and this gives all the XML code etc and the browser handles the collapse and expand.

        This is not a great UX and it shows the structure to everyone who visits the page - more than a bit risky.

        Really this is a PHP script to build the HTML display including some JavaScript to handle the interactive elements.

        nathj

        Comment

        • Dormilich
          Recognized Expert Expert
          • Aug 2008
          • 8694

          #5
          Originally posted by nathj
          ... Really this is a PHP script to build the HTML display ...
          personally I'd recommend XSLT for that (using PHP's XSLTProcessor class).

          Comment

          Working...