473,757 Members | 9,463 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Word wrapping in php

9 New Member
Hi all,

I'm working on designing a forum. I'm using PHP, with a mysql database, displaying the user-input results in a formatted table. Pretty standard. My questions concerns word wrapping. Normally, when the data reached the end of the table, it'll wrap to the next line. However, when people post links, the link itself will not wrap around (as it is all basically one word) and will cut right through the table's border, completely destroying my display. This is a strange problem actually in the sense that I do not see this happening with Internet Explorer, only with firefox. Now I know I can use wordwrap(), but the problem with this is it'll add an extra space before the start of the next line, so if someone were to copy and paste the link, it would render the link useless. How can I get around this problem?

Thanks!
Oct 27 '07 #1
2 1599
adamalton
93 New Member
I don't think there is an easy solution. If you look on the wordwrap() page of the php manual (on www.php.net) you will see that lots of people have posted their own methods for getting round the problem. Personally I find wordwrap() totally useless.

One solution would be to use regular expressions - using preg_replace() - to shorten the TEXT of the links, but leave the href in tact. E.g.....

Your user posts:
Hey check this cool site, http://www.really_long _url.com/really_long.

And you replace it with:[HTML]Hey check this cool site,
<a href="http://www.really_long _url.com/really_long">ht tp://www.really_lo.. ..</a>[/HTML]
Oct 28 '07 #2
AnilM823
9 New Member
Interesting suggestion. I'll give it a shot, thanks
Nov 1 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1404
by: Dave Navarro | last post by:
We have a project where we are using the Send2fax.com gateway to send faxes from our web site. Send2Fax does not word wrap emails, so I have to do that manually. This is my "quick and dirty" code: Function WrapLine(ByVal txt, ByVal where) Dim temp Dim l words = Split(txt, " ")
11
5607
by: yawnmoth | last post by:
word wrapping normally treats some spaces as line feeds, if there hasn't been a line feed for quite a while. so while a string with eighty consecutive a's might not word wrap, a space placed squarely in the middle of that string will sorta word wrap. so why doesn't it seem to work with !'s? here's a page that demonstrates how !'s don't seem to word wrap: http://www.geocities.com/terra1024/wordwrap.htm here's a page that shows how...
5
5296
by: nimdez | last post by:
Hi, I am working on an existing code base in which a lot of data displayed to the user is formatted in tables. Most tables are printed row-by-row using printf() with "%s" print conversion specification for each column (e.g. printf(%10s %25s %15s\n", pszCol1, pszCol2, pszCol3)). My problem is that when a string is longer the column's width, it overflows the column and takes the table out of alignment. What I want it to do is word-wrap...
0
1808
by: Dean Bortell | last post by:
I am getting information from an access 2k2 table and displaying it on a form. My problem is one of the fields is a memo field. This field contains important information. Is there anyway to get the listview to word- wrap in this column? Am I missing the boat on this? Is there a better way? There may be many different messages recorded on different dates, therefore I need to organize them vertically. In ASP.net the datagrid could do...
0
970
by: Brian Conway | last post by:
Anyone know how to turn off word wrapping on the datagrid. I have gone into Property Builder and shut it off there, however, it is still wrapping. Any help would be appreciated.
1
1293
kestrel
by: kestrel | last post by:
i have a textarea, and how do i make it so that it automatically breaks to the next line when the user reaches the end?
1
1979
by: tonten | last post by:
I've been searching for a while now for a solution to the firefox word wrapping issue. I found a solution here @ http://javascript.about.com/library/blspline.htm I followed the instructions exactly but I cannot get it to work. I am not a programmer and I am just wondering if this function is broken? I tried everything I can think of with document.write I can't get any text to output or sometimes I get "undefined" as an output.
1
1380
by: MikeY | last post by:
Hi Everyone, How do I stop my word wrapping with in my .Net Evironment.. While coding away, I pressed "something" and I lost my horizontal scroll bar, and now all my code has been word wrapped to the next line. I know there is a solution but can't find it under options Txs MikeY
8
2185
by: rotorio | last post by:
Hi, I am new to php and I am trying to edit one free comment script to fit my needs. The last thing left is to make a word wrapping in comment <div>. It musn't be hard but because I lack understanding in it i have failed to do it myself. I have tried to use many functions but any of them did a job. I must have used them in the wrong way. This is the link of full script code: Comment Form Script Tutorial (It's free too!) Here is my code: ...
0
9489
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9298
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10072
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9906
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9885
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6562
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5172
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3829
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3399
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.