Jump to content

Help needed on Inserting wordwrap function


widget

Recommended Posts

Hi,

 

I would like some help on how to incorporate wordwrap in the code below.

I've tried a few different ways but as a newb I just stuff it up.

 

	$getShops[shop_desc] = strip_tags(substr("$getShops[shop_desc]", 0, 350), " <b><br><a><img><font>");
$getShops[shop_desc] .= "...";

  • 2 weeks later...

well users can edit their own profile and shop pages.

 

Sometimes people put a continuous string of characters such as hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhi and it breaks the page layout.

 

I would like to have long strings of text automatically broken up.

 

This is my current code which outputs the data.

 

$getShops[shop_desc] = strip_tags(substr("$getShops[shop_desc]", 0, 350), " <b><br><a><img><font>");
$getShops[shop_desc] .= "...";

 

When trying to implement word wrap (see example I found below)

 

<?php
$text = "A very long woooooooooooord.";
$newtext = wordwrap($text, 8, "\n", true);

echo "$newtext\n";
?>

 

How would i incorporate this into my code above?

 

Or does the wordwrap code need to go in the form the user uses to enter their descriptions or does it get melded into my original code above?

 

 

Its hard to explain

 

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.