Jump to content

wordwrap not wrapping


graham23s

Recommended Posts

Hi Guys,

 

I'm using the simple php dom class to parse an html page, i'm using the ->plaintext; to just retrieve the words rather than the html, then i'm trying to wordwrap:

 

<?php
   $prodID = $_GET['productID'];
   $q      = mysql_query("SELECT * FROM `dig_products` WHERE `id`='$prodID'");
   $a      = mysql_fetch_array($q);
   $s      = $a['product_original_url']; 
   $html   = file_get_html($s)->plaintext;
   
   echo "<center><textarea rows='50' cols='50'>" . wordwrap($html, 10, "\n", true) . "</textarea></center>"; 
   //echo "<pre>$html</pre>";
?>

 

the problem is it's not wordwrapping the text no matter what number i set it to, i'm stumped

 

thanks for nay help guys

 

Graham

Link to comment
Share on other sites

So you are clicking view source and there are no line breaks? If you aren't clicking view source then you won't see any line breaks since \n characters are ignored within HTML documents. You would need to use '<br/>\n' as your 3rd parameter.

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.