Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Jak formatować tekst, aby po przekroczeniu określonej długości przechodził do nowej linii?, tekst w linijkach
Soulast
post
Post #1





Grupa: Zarejestrowani
Postów: 133
Pomógł: 6
Dołączył: 26.10.2009

Ostrzeżenie: (0%)
-----


Jak formatować tekst, aby po przekroczeniu określonej długości przechodził do nowej linii?

Chce sformatować tekst, aby przełamał się gdy przekroczy określoną ilość znaków i nie będzie się mieścił w jednej linijce.
Użytkownicy często nie panują nad tym co i jak piszą. Potrafią w formularzu umieścić bardzo długie zdania bez naciśnięcia entera, a często zdarzy się, że wprost napiszą dłuuuuuuuuuuuuuuuuuuuuuugi wyraz, który spowoduje rozjechanie się strony.
Tutaj właśnie mam problem posiadam oto taki skrypt dla komentarzy gdzie po wpisaniu bardzo długiego tekstu on się nie rozdziela na pare linii tylko nie potrzebnie poszerza stronę:/
Próbował dodać wartości wysokości oraz szerokości do table, td, czy nawet div lecz bez skutku..
Bardzo proszę o pomoc..

Oto część mojego kodu:

  1. <table style='background-image: url(images/combg.png); background-repeat: no-repeat; background-position:center; width=529px; height=96px; border-color: transparent; border-style: solid;' width='529px' border='0' cellspacing='1' cellpadding='1'>
  2. <tr>
  3. <td align='center' width='20%' height='80%'><br>$photo</td>
  4. <td align='left' valign='top' width='20%' height='80'><font color='black'><br>&nbsp;&nbsp;&nbsp;&nbsp; $comment</font></td>
  5. </tr>
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Soulast
post
Post #2





Grupa: Zarejestrowani
Postów: 133
Pomógł: 6
Dołączył: 26.10.2009

Ostrzeżenie: (0%)
-----


Oto ogólnie jest cały kod..

  1. $totalfriends=mysql_query("SELECT COUNT(*) FROM friends WHERE userid='$member[id]'");
  2. $totalfriends=mysql_fetch_array($totalfriends);
  3. $totalfriends="$totalfriends[0]";
  4. $friendcount=mysql_num_rows(mysql_query("SELECT userid FROM friends WHERE userid='$member[id]' ORDER BY priority ASC LIMIT 0,7"));
  5. if($totalfriends==1){
  6. $fname="<font color='black'>Buddy</font>";
  7. } else {
  8. $fname="<font color='black'>Buddys</font>";
  9. }
  10. if($totalfriends!=0){
  11. $fcount=(7/$friendcount);
  12. }
  13. $userfriends=mysql_query("SELECT id,userid,friendid FROM friends WHERE userid='$member[id]' ORDER BY priority ASC LIMIT 0,8");
  14. while(list($id,$userid,$friendid)=mysql_fetch_row($userfriends)){
  15. $pfriend=mysql_query("SELECT * FROM members WHERE id='$friendid'");
  16. $pfriend=mysql_fetch_array($pfriend);
  17. if(($pfriend[photo]) && ($pfriend[photo]!="http://")){
  18. $fphoto="<img src='$pfriend[photo]' border='0' onLoad='resize_logo2( this );' onLoad='resize_logo2( this );' width='52' height='47'/>";
  19. }else{
  20. $fphoto="<img src='./images/avf.png' border='0' onLoad='resize_logo2( this );' width='90' height='74'/>";
  21. }
  22. $listfriends.="
  23. <td valign='top' align='center'>
  24. <a href='./profile.php?account=$pfriend[id]'>$fphoto</a><br>
  25. <a href='./profile.php?account=$pfriend[id]'><b>$pfriend[name]</b></a></td>";
  26. }
  27. if($totalfriends != 0){
  28. $out[body].="
  29. <table width='160' border='1' cellspacing='1' cellpadding='1'>
  30. <tr>
  31. $listfriends
  32. </tr>
  33. </table><br />
  34. ";
  35. } else {
  36. $out[body].="
  37. <table width='98%' border='0' cellspacing='1' cellpadding='1'>
  38. <tr>
  39. <td width='100%' valign='top' align='center'>No Current Friends.</td>
  40. </tr>
  41. </table>
  42. <br />";
  43. $out[body].="
  44. <table width='100%' border='0' cellspacing='1' cellpadding='1'>
  45. <tr>
  46. <td valign='center' align='right' width='170' height='20' colspan='$friendcount'><b>$totalfriends </b> <a href='./profile.php?action=editfriends&mem=$member[id]'>View All Friends</a></td>
  47. </tr></table>
  48. <tr><td> </td></tr>
  49. ";
  50. }


Ten post edytował Soulast 13.01.2010, 21:08:57
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 29.12.2025 - 22:32