How to take a Serialized String from the DB and output a UL list with Coldfusion
Posted
by nobosh
on Stack Overflow
See other posts from Stack Overflow
or by nobosh
Published on 2010-05-20T04:31:07Z
Indexed on
2010/05/20
4:40 UTC
Read the original article
Hit count: 253
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
© Stack Overflow or respective owner