Mr Chris Posted July 14, 2006 Share Posted July 14, 2006 Hi Guys,Say I’m pulling a record out of my database and have 350 words (as an example) as the [b]body_text[/b] . I’d usually just do this:<?php echo nl2br($body_text); ?>But, what I want to do is split the text up. So I can wrap a picture around the text at the start of the text. Then again somewhere in the middle I could wrap a quote box around the text like they have done on the BBC site:http://news.bbc.co.uk/sport1/hi/football/world_cup_2006/teams/italy/5177140.stmNow I was recommended to do this I should look at the function [b] substr[/b]But it seems you have to know the amount of words that you will use using this function as shown:http://www.w3schools.com/php/func_string_substr.aspSo can anyone offer me any advise on how I can do this?Many ThanksChris Quote Link to comment https://forums.phpfreaks.com/topic/14571-splitting-up-text-called-from-database/ Share on other sites More sharing options...
zq29 Posted July 14, 2006 Share Posted July 14, 2006 Wouldn't it be easier to position all of the elements with CSS and have the text auto-wrap around them? Quote Link to comment https://forums.phpfreaks.com/topic/14571-splitting-up-text-called-from-database/#findComment-57811 Share on other sites More sharing options...
Mr Chris Posted July 14, 2006 Author Share Posted July 14, 2006 Thanks, but I don't understand how i'd do this as surely if I just echo:<?php echo nl2br($body_text); ?>That will just output all the text and any positioned DIV's will not wrap around the outputted text?ThanksChris Quote Link to comment https://forums.phpfreaks.com/topic/14571-splitting-up-text-called-from-database/#findComment-57815 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.