I have a multilevel list, example below:
<ul>
<li>Test column 01
<ul>
<li>Test column 02
<ul>
<li>Test column 03
<ul>
<li>Test column 04
<ul>
<li>Test column 05</li>
<li>Test column 05</li>
<li>Test column 05</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
I would like to run some php code that outputs the list as a csv file, formatted like below:
Test column 01
,Test column 02
,,Test column 03
,,,Test column 04
,,,,Test column 05
,,,,Test column 05
,,,,Test column 05
Basically, I want to be able to run an html list, (with an unlimited amount of levels), through some php code, and output a csv file that can be opened in excel, preserving the list levels in columns.
If I could find some way of adding a class to each list item, depending on its level, so first level list items get a class of level1, second level, a class of level2 etc etc, then it should be fairly straightforward to find and replace the rest.
Any ideas/help greatly appreciated.
increment it, when found a
decrement it. Iterator will be the level (and how many commas you have). – BG Adrian Mar 01 '13 at 12:36