Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.