Jump to content

Splitting up text called from database


Mr Chris

Recommended Posts

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.stm

Now 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.asp

So can anyone offer me any advise on how I can do this?

Many Thanks

Chris
Link to comment
https://forums.phpfreaks.com/topic/14571-splitting-up-text-called-from-database/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.