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] .= "...";

Link to comment
Share on other sites

  • 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

 

Link to comment
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.