DamienRoche Posted September 12, 2008 Share Posted September 12, 2008 I have just begun learning how to use fopen() etc. etc. and have run into a little problem when calling the data from a .txt The issue is that sometimes the data is not wrapped when I use divs, even specifying width. I figured CSS would take over the wrapping but it just isn't. I have also tried using wordwrap() but I can't figure out how to make it wrap whole words to the next line. $context3 = wordwrap($context2, 200, "-<br>\n"); This isn't really ideal in that I have to specify a character limit instead of pixels. But it will do if I can get the above function to work like I mentioned. EDIT: I forgot to mention something very important. I am using a pre tag to preserve certain line breaks because without it, the text is a constant string. Is there an alternative in php? how can I control the behavior? As always, I am very grateful for any help. Link to comment https://forums.phpfreaks.com/topic/123906-using-text-files-to-dynamically-edit-a-page-word-wrap/ Share on other sites More sharing options...
simonrs Posted September 12, 2008 Share Posted September 12, 2008 If you've got a div which has a width set, and you put content into that div, it should wrap according to the width. Post your html (with css) code of the page with this content inserted and it'll be easier for someone to help. Link to comment https://forums.phpfreaks.com/topic/123906-using-text-files-to-dynamically-edit-a-page-word-wrap/#findComment-639642 Share on other sites More sharing options...
DamienRoche Posted September 12, 2008 Author Share Posted September 12, 2008 Thanks for the response. The issue is definitely not the css. I'm no beginner with css like php. The issue is undoubtedly the < pre > tag. The whole point of it is to preserve the line breaks. But I want to modify how it behaves. Or possibly mimic it's behavior using php. Does anyone know how the pre tag preserves line breaks or how I can, using php? Thanks again. Link to comment https://forums.phpfreaks.com/topic/123906-using-text-files-to-dynamically-edit-a-page-word-wrap/#findComment-639654 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.