473,386 Members | 2,042 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Word wrapping in php

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 1578
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">http://www.really_lo....</a>[/HTML]
Oct 28 '07 #2
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
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"...
11
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...
5
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...
0
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...
0
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
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
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...
1
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...
8
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...

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.