Jump to content

php displayed .txt file word wrapping in a div


davemcc

Recommended Posts

Hello can anyone help?!

 

I am using the following php within a div

 

<?php  $lines = file("news.txt");

 

echo '<pre>';

 

foreach($lines as $line)

  echo str_replace("<", "<", $line)."\n";

 

echo '</pre>'; ?>

 

Is their any way to constrain the php displayed txt to within the div width

 

see http://mickleovercommunitycentre.co.uk/Oakwood/phptrial2.php latest news box for my prob.

 

any help would be great!

 

Dave

<div id="Layer2" style="width:292px; height:226px;" class="newsposition"> 
  <p>Latest News </p>
  <p>

<?php  //$lines = file("http://mickleovercommunitycentre.co.uk/Oakwood/news.txt");
$myFile = "http://mickleovercommunitycentre.co.uk/Oakwood/news.txt";
$fh = fopen($myFile, 'r');
$theData = fgets($fh);
fclose($fh);
echo $theData;
?>
</p>
</div>

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.