Vigilant Psyche Posted April 10, 2008 Share Posted April 10, 2008 Hey, guys. If I have a table and it has a long word in it, say "ooooooooooooo" is there a function to add a space where the text becomes too long for the tables? Thanks. Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted April 10, 2008 Share Posted April 10, 2008 did u try wordwrap? Quote Link to comment Share on other sites More sharing options...
Vigilant Psyche Posted April 10, 2008 Author Share Posted April 10, 2008 Yeah but I wan't to wrap to pixels, number of letters doesn't help much... Hehe 4,5,6-tri X benzene Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted April 10, 2008 Share Posted April 10, 2008 you have a lot of "letters" and you want to "wrap" them sounds good to me fyi it is 1,2,3-trimethyl-benzene Quote Link to comment Share on other sites More sharing options...
rhodesa Posted April 10, 2008 Share Posted April 10, 2008 You can't wrap to pixels, just to number of characters. You can specify the width of the table column with CSS and it should move the word to the next line. Quote Link to comment Share on other sites More sharing options...
Vigilant Psyche Posted April 10, 2008 Author Share Posted April 10, 2008 Yes but what sort of argument would I use? 10 letters? This would not be appropriate as it would stop short sometimes and overflow other time because eg "M" is longer than "I". So I want to be able to stick in a newline if its over X pixels. Really? I thought we number anticlockwise? Oh no, I have my chem exam in a month! XD EDIT: so it would auto matically split a word that was to long, even if there are no spaces like "ooooooooooooooooooooooooooo"? Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted April 10, 2008 Share Posted April 10, 2008 no u take the whole string and warp it to fit i.e wrap "Marry had a little lamb, its fleece was white as snow"; to say 10 characters becomes "Marry had a little la mb, its fle ece was wh ite as snow" Quote Link to comment Share on other sites More sharing options...
rhodesa Posted April 10, 2008 Share Posted April 10, 2008 Short answer: In my experience there is no way to accomplish what you are trying to do. Quote Link to comment Share on other sites More sharing options...
Vigilant Psyche Posted April 10, 2008 Author Share Posted April 10, 2008 here's what I wan't to do... see how there is an entry in "blogs" which is too long? http://www.scd.simtoz.com/ I need it to fit to the width of the table much like on this site: http://www.64digits.com/ Quote Link to comment Share on other sites More sharing options...
rhodesa Posted April 10, 2008 Share Posted April 10, 2008 I understand...you might be able to find something with Javascript, but with PHP you can only work with the number of characters a string has. There is no way to calculate (from PHP) what the length of each character is and if it will fit. PHP doesn't know how the users browser will interpret the characters. Maybe the browser doesn't have the font you suggest using, so it uses something else. Or maybe the user has selected to have the font on all pages enlarged to make it easier to read. Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted April 10, 2008 Share Posted April 10, 2008 There is no way to calculate (from PHP) what the length of each character is and if it will fit. gd has a way to get a strings size in a give TTF font + font size +font angle, but its not exactly ideal Quote Link to comment Share on other sites More sharing options...
rhodesa Posted April 10, 2008 Share Posted April 10, 2008 yeah, but there are still other factors going into the font size that you can't account for Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.