melting_dog Posted December 13, 2011 Share Posted December 13, 2011 Hi all, Weird one: I am re-working a site for a client. Their old site currently grabs text from a DB and somehow automatically puts it into a <ul>. The only thing to signify a <li> is a linebreak. So if I entered: Item 1 Item 2 Item 3 into the database, they would come out looking like: Item1 Item 2 Item 3 on the site. Anyone know of a way to recreate this? An example of this in action is here: http://www.postureperfection.com.au/Chairs/Amore_Chair/p/495/ (please remember - I am redesigning the site!) Thanks heaps! Quote Link to comment https://forums.phpfreaks.com/topic/253082-automatic-creation-of-list-when-getting-text-from-db/ Share on other sites More sharing options...
trq Posted December 13, 2011 Share Posted December 13, 2011 explode the string by line breaks then loop through the created array creating an unordered list. Quote Link to comment https://forums.phpfreaks.com/topic/253082-automatic-creation-of-list-when-getting-text-from-db/#findComment-1297474 Share on other sites More sharing options...
melting_dog Posted December 15, 2011 Author Share Posted December 15, 2011 Thanks for that Thorpe, But could you help me out a little more - I havent used the explode function before. I try it and it prints the entire array eg: Array ( [0] =>Item 1 [1]=>Item 2 etc. Also, how would I tell it to explode after a line break? Thanks heaps! Quote Link to comment https://forums.phpfreaks.com/topic/253082-automatic-creation-of-list-when-getting-text-from-db/#findComment-1298095 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.