473,516 Members | 3,355 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What next to achieve collapsable style?

178 New Member
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.


Expand|Select|Wrap|Line Numbers
  1. <?xml-stylesheet href='completeproject.css' type='text/css'?> 
  2. <companies>
  3.     <company id='PORTASILO'>
  4.     <project id='00001'>
  5.         <project_name>LAFARGE</project_name>
  6.     </project>
  7.     <project id='00003'>
  8.         <project_name>PATRICKSWELL</project_name>
  9.     </project>
  10.     <project id='00004'>
  11.         <project_name>TP033</project_name>
  12.     <panel>
  13.         <panel_name>PANELB</panel_name>
  14.     </panel>
  15.     </project>
  16.     </company>
  17.     <company id='BI WATER'>
  18.     <project id='00002'>
  19.         <project_name>LEE TUNNEL</project_name>
  20.     </project>
  21.     <project id='00005'>
  22.         <project_name>TP34</project_name>
  23.     <panel>
  24.         <panel_name>PANELA</panel_name>
  25.         <status>Complete</status>
  26.     </panel>
  27.     </project>
  28.     </company>
  29.     </companies>
  30.  
completeproject.css
Expand|Select|Wrap|Line Numbers
  1. companies company project project_name{
  2. background-color:#538620;  
  3.     border-bottom-width:0;  
  4.     color:#FFF;   
  5.     font-size:110%;  
  6.     font-weight:bold;  
  7.     margin:0;  
  8.     padding:0.3em 0.5em;
  9.     display:block;   
  10. }  
  11. companies company project panel panel_name{
  12.     background-color:gray;
  13.     color:white;
  14.     display:block; 
  15.     padding:0.3em 0.9em;
  16.  
  17. }
Dec 4 '08 #1
4 1315
Dormilich
8,658 Recognized Expert Moderator Expert
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
Dec 4 '08 #2
Frinavale
9,735 Recognized Expert Moderator Expert
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
Dec 16 '08 #3
nathj
938 Recognized Expert Contributor
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
Dec 18 '08 #4
Dormilich
8,658 Recognized Expert Moderator Expert
@nathj
personally I'd recommend XSLT for that (using PHP's XSLTProcessor class).
Dec 18 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
1408
by: news | last post by:
Is there a way to write an XML doc so that you can still format the text, bold and whatnot, and still have it display in a collapsable tree format? Here's what I'm using as a test: <?xml version="1.0" encoding="iso8859-1"?> <?xml-stylesheet type="text/css" href="xml-style.css"?> <result> <date>2005-05-19
47
9078
by: Neal | last post by:
Patrick Griffiths weighs in on the CSS vs table layout debate in his blog entry "Tables my ass" - http://www.htmldog.com/ptg/archives/000049.php . A quite good article.
3
1197
by: J | last post by:
Hello, I'd like to create sections that are collapsible via clicking on a graphic next to (or above) the section (e.g. collapsible cells of a table) I've given both the graphic and the section an ID property and I have written this: function hideShow (name1) {
3
1402
by: The Bear | last post by:
Is there a way to create a collapsable datagrid. Where multiple areas of the grid can be expanded or collapsed? Using C# and Windows Forms
1
1388
by: Brian Henry | last post by:
How do you make a collapsable list in html? I remember doing it in the past but cant remember how exactly to.. thanks!
7
1455
by: Rlrcstr | last post by:
How would one implement collapsable paragraphs of text in an HTML page? I want the sections of the document to be expandable for full text or collapsed into just the section heading. Any help is appreciated. Jerry
6
4216
by: Duncan | last post by:
Does anybody know how the following can be acheived using html or xhtml? I need to present colleagues with a 'to-do' list. Lets say the list has ten or so jobs and each job consists of five or so steps, most colleagues will already know how to perform a number of these jobs, so rather than show all jobs with all steps, by default, I'd like...
27
5295
by: Steven D'Aprano | last post by:
I thought that an iterator was any object that follows the iterator protocol, that is, it has a next() method and an __iter__() method. But I'm having problems writing a class that acts as an iterator. I have: class Parrot(object): def __iter__(self): return self def __init__(self): self.next = self._next()
12
1283
by: Mark | last post by:
Hi I'm looking to create a colapsable list like what we see in a news reader or on a forum. - Basically, any number of levels up to 10 (i.e. more than whats likely to be needed) - Able to expand/collapse each branch independantly
0
7273
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7574
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7136
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7547
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5712
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
1620
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
823
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
487
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.