Hi everyone, this my first post here, so be gentle 🙂
I need a (php) script that can convert a hierarchical text list like this:
- text1
- - subtext1
- - subtext2
- - - subsubtext1
- text2
into a html ul-list with sub-lists like this:
<ul>
<li>text1
<ul>
<li>sub-text1</li>
<li>sub-text1
<ul>
<li>sub-sub-text1</li>
</ul>
</li>
</ul>
</li>
<li>text2</li>
</ul>
I have searched high and low for this, with no luck. I realize that is it should be a simple thing to do, and I have tried myself, but it I can't make it work.
So my question is this:
Does anyone know of an existing script that can do this, or do you have any ideas how to go about this?
Any help is much appreciated. Thanks.
[EDIT: Used dashes in stead of space indent.]