How to take a Serialized String from the DB and output a UL list with Coldfusion
- by nobosh
Given a string from the database as follows:
ul[0][id]=main1&ul[0][children][0][id]=child2&ul[0][children][0][class]=&ul[1][id]=main3&ul[2][id]=main4&ul[3][id]=main5
Where what's after the equal sign is an ID, how can I take this string on the backend and build out a list as following from front-end output?
<UL id="container">
<LI id="main1">
Lorem ipsum dolor sit amet, consectetur
<UL>
<LI id="child2">
In hac habitasse platea dictumst.
<UL></UL>
</LI>
</UL>
</LI>
<LI id="main3">
In hac habitasse platea dictumst.
<UL></UL>
</LI>
<LI id="main4">
In hac habitasse platea dictumst.
<UL></UL>
</LI>
<LI id="main5">
In hac habitasse platea dictumst.
<UL></UL>
</LI>
</UL>
Thanks