login  Naam:   Wachtwoord: 
Registreer je!
 Forum

Enter regelnummering

Offline delta_004 - 24/04/2005 08:10 (laatste wijziging 24/04/2005 09:25)
Avatar van delta_004Onbekend Hoi
Bij dit script werkt de enter niet als ik hem bij de ubb codes gebruik
  1. <?php
  2.  
  3.  
  4. /* highlight scriptje */
  5. function phphighlite($code) {
  6.  
  7.  
  8.  
  9. if (floor(phpversion())<4) {
  10. $return = $code;
  11. } else {
  12.  
  13. $code = str_replace("<br>", "", $code);
  14. $code = str_replace("<br />", "", $code);
  15. $code = str_replace("&gt;", ">", $code);
  16. $code = str_replace("&lt;", "<", $code);
  17. $code = str_replace("&amp;", "&", $code);
  18. $code = str_replace('$', '\$', $code);
  19. $code = str_replace('\n', '\\\\n', $code);
  20. $code = str_replace('\r', '\\\\r', $code);
  21. $code = str_replace('\t', '\\\\t', $code);
  22. $code = str_replace('&quot;', '"', $code);
  23. $code = stripslashes($code);
  24. $code = trim($code);
  25. $code = str_replace("<br /><br />", "", $code);
  26. $regels = explode("\n", $code);
  27. $aantal = count($regels) +1;
  28. $aantalr = count($regels);
  29. $oldlevel=error_reporting(0);
  30. error_reporting($oldlevel);
  31. $code = ob_get_contents();
  32.  
  33. $return .= "<center>";
  34. $return .= "<div align='center'>";
  35. $return .= "<table class='tekst' cellspacing='0' cellpadding='3' border='0' style='border-collapse: collapse; border-right: 1px solid #808080; border-top: 1px solid #808080; border-left: 1px solid #808080; border-bottom: 1px solid #808080' width='670' bgcolor='#D6D6D6'>\n";
  36. $return .= "<tr>\n";
  37.  
  38. $return .= "<td width='2%' style='border-collapse: collapse'><font color='black'><b>Code</b></td><td width='740' align='right' style='border-collapse: collapse'><font color='black'>(".$aantalr." regels)</font></td>\n";
  39. $return .= "</tr>\n";
  40. $return .= "</table>\n";
  41.  
  42. $return .= "<!-- code table -->\n";
  43. $return .= "<table align='center' cellspacing='0' cellpadding='0' border='0' >\n";
  44. $return .= "<tr>\n";
  45. $return .= "<td>\n";
  46. $return .= "<table align='center' cellspacing='0' cellpadding='3' border='0' width='670' bgcolor='#D6D6D6' style='border-collapse: collapse; border: 1px solid; border-color: #808080; border-top; 0px solid'>\n";
  47. $return .= "<tr>\n";
  48. $return .= "<td width='1' valign='top' align='left' style='font-family: Courier New; font-size: 11px; border-right: 1px solid #808080'>\n<font color='black'>";
  49. for($i = "1"; $i < $aantal; $i++)
  50. {
  51. $return .= $i."<br />";
  52. }
  53. $return .= "</td>\n";
  54. $return .= "<td valign='top' bgcolor='#FFFFFF'>\n";
  55. $return .= "<table cellspacing='0' cellpadding='0' border='0' width='95%' style='table-layout: fixed;'>\n";
  56. $return .= "<tr>\n";
  57. $return .= "<td nowrap valign='top' style='font-family: Courier New; font-size: 11px'>\n";
  58. $return .= "\n";
  59. $return .= "".$code."\n";
  60. $return .= "\n";
  61. $return .= "</td>\n";
  62. $return .= "</tr>\n";
  63. $return .= "</table>\n";
  64. $return .= "</td></tr></table>\n";
  65. $return .= "</td></tr></table><br />\n";
  66. $return .= "</center></div>";
  67.  
  68.  
  69. $return = str_replace("&quot;", "\"", $return);
  70. }
  71.  
  72. return $return;
  73. }
  74.  
  75. ?>

En de ubb is
  1. $bericht = eregi_replace("\\[url=([^\\[]*)\\]([^\\[]*)\\[/url\\]","<a href=file://1 target=_blank>\\2</a>",$bericht);

Alvast bedankt

4 antwoorden

Gesponsorde links
Offline MechaVore - 24/04/2005 09:44 (laatste wijziging 24/04/2005 09:45)
Avatar van MechaVore Gouden medaille

PHP gevorderde
gebruit dit :
  1. <?
  2. echo nl2br(phphighlite($code));
  3. ?>
of zet het in dit stukje code 
Offline Tuinstoel - 24/04/2005 09:51
Avatar van Tuinstoel PHP expert
  1. $code = str_replace("<br>", "", $code);
  2. $code = str_replace("<br />", "", $code);


Heeft dat niet iets met newlines te maken :roll:...
Offline delta_004 - 24/04/2005 10:12 (laatste wijziging 24/04/2005 10:15)
Avatar van delta_004 Onbekend uh het is een ubb dus ik zet hem in de functie
Srry krijg het niet:$
Offline Fenrir - 24/04/2005 11:22
Avatar van Fenrir PHP expert
  1. $code = str_replace("<br>", "", $code);
  2. $code = str_replace("<br />", "", $code);


Dat moet je gewoon weghalen?
Gesponsorde links
Dit onderwerp is gesloten.
Actieve forumberichten
© 2002-2024 Sitemasters.be - Regels - Laadtijd: 0.236s