ubb code mit highlite_string

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ubb code mit highlite_string

    hi

    wider hab ich ma ein problem

    ich möchte ähnlich wie hier php in meine posts bringen können... doch wie mach ich es?

    ich hab bis jetzt das...

    PHP Code:
         $msg = str_replace("[high]","<?php highlight_string(",$msg);
        
    $msg = str_replace("[/high]","); ?>",$msg);
    jedoch gibt es nichts aus

    hoffe es kann mir jemand helfen
    First: Things get worse under pressure.
    Second: If anything just cannot go wrong, it will anyway
    Third: A falling object will always land where it can do the most damage.

  • #2
    PHP Code:
    highlight_string($deincodestring); 

    oder hast du was anderes vor?
    INFO: Erst suchen, dann posten![color=red] | [/color]MANUAL(s): PHP | MySQL | HTML/JS/CSS[color=red] | [/color]NICE: GNOME Do | TESTS: Gästebuch[color=red] | [/color]IM: Jabber.org |


    Comment


    • #3
      ich möchte nur, dass wenn man bei meinem ubbcode [high]<?php echo "test"; ?>[/high] eingiebt, der text also <?php echo "test"; ?> gehighlitet rauskommt....
      First: Things get worse under pressure.
      Second: If anything just cannot go wrong, it will anyway
      Third: A falling object will always land where it can do the most damage.

      Comment


      • #4
        hoffe, dass dir das schon weiterhilft. muss noch was anderes machen....

        PHP Code:
            
            $msg 
        "dein text[high]dein hightlight text[/high]und hier gehts weiter normal";

            
        // hier wird das zwsichen dem high geholt.
            // hoffe, dass es klappt. ist nicht getestet
            
        $msghlt preg_replace("/(.*?)\[high\](.*?)\[\/high\](.*?)/i""$2"$msg);
            
            
            
        // ausgabe
            
        highlight_string($msghlt); 
        INFO: Erst suchen, dann posten![color=red] | [/color]MANUAL(s): PHP | MySQL | HTML/JS/CSS[color=red] | [/color]NICE: GNOME Do | TESTS: Gästebuch[color=red] | [/color]IM: Jabber.org |


        Comment


        • #5
          PHP hat backslashes geschluckt.
          hier als CODE

          Code:
              
              $msg = "dein text[high]dein hightlight text[/high]und hier gehts weiter normal";
          
              // hier wird das zwsichen dem high geholt.
              // hoffe, dass es klappt. ist nicht getestet
              $msghlt = preg_replace("/(.*?)\[high\](.*?)\[\/high\](.*?)/i", "$2", $msg);
              
              
              // ausgabe
              highlight_string($msghlt);
          INFO: Erst suchen, dann posten![color=red] | [/color]MANUAL(s): PHP | MySQL | HTML/JS/CSS[color=red] | [/color]NICE: GNOME Do | TESTS: Gästebuch[color=red] | [/color]IM: Jabber.org |


          Comment


          • #6
            thx ich versuchs mal
            First: Things get worse under pressure.
            Second: If anything just cannot go wrong, it will anyway
            Third: A falling object will always land where it can do the most damage.

            Comment


            • #7
              Probleme mit dem Lesen??

              In der Doku steht's unter mixed preg_replace ( mixed pattern, mixed replacement, mixed subject [, int limit]) genau beschrieben ... (Stichwort "/e modifier") ...

              Zu den Modifiers gibt auch ein Kapitel: Pattern Modifiers
              carpe noctem

              [color=blue]Bitte keine Fragen per EMail ... im Forum haben alle was davon ... und ich beantworte EMail-Fragen von Foren-Mitgliedern in der Regel eh nicht![/color]
              [color=red]Hinweis: Ich bin weder Mitglied noch Angestellter von ebiz-consult! Alles was ich hier von mir gebe tue ich in eigener Verantwortung![/color]

              Comment


              • #8
                hm geht auch nich richtig!
                ich poste mal mein anderes zeug dazu vielleicht nützt das...


                [CODE] function ubb($msg)
                {
                global $link;

                // Horizontale Linie
                $msg = str_replace("[hr]","<hr>",$msg);

                // Text Fett schreiben
                $msg = str_replace("","<b>",$msg);
                $msg = str_replace("
                ","</b>",$msg);

                // Text Krusiv schreiben
                $msg = str_replace("","<i>",$msg);
                $msg = str_replace("
                ","</i>",$msg);

                // Text Unterstreichen
                $msg = str_replace("","<u>",$msg);
                $msg = str_replace("
                ","</u>",$msg);

                // Textfarbe ROT
                $msg = str_replace("[red]","<font color='red'>",$msg);
                $msg = str_replace("[/red]","</font>",$msg);

                // Textfarbe BLAU
                $msg = str_replace("[blue]","<font color='blue'>",$msg);
                $msg = str_replace("[/blue]","</font>",$msg);

                // Textfarbe GRÜN
                $msg = str_replace("[green]","<font color='green'>",$msg);
                $msg = str_replace("[/green]","</font>",$msg);

                // Textgröße 2
                $msg = str_replace("[2]","<font size='2'>",$msg);
                $msg = str_replace("[/2]","</font>",$msg);

                // Textgröße 3
                $msg = str_replace("[3]","<font size='3'>",$msg);
                $msg = str_replace("[/3]","</font>",$msg);

                // Textgröße 4
                $msg = str_replace("[4]","<font size='4'>",$msg);
                $msg = str_replace("[/4]","</font>",$msg);

                // Bild im Text
                $msg = str_replace("[img]","<image border=0 src=",$msg);
                $msg = str_replace("[/img]",">",$msg);

                // [URL]
                $msg = preg_replace("/\[url](.*)\[\/url\]/siU","<a href=\"\\1\" target='_blank'>\\1</a>",$msg);

                // [URL=
                $msg = preg_replace("/\[url=(.*)](.*)\[\/url\]/siU","<a href=\"\\1\" target='_blank'>\\2</a>",$msg);

                // [email]
                $msg = preg_replace("/\[email](.*)\[\/email\]/siU","<a href=\"mailto:\\1\">\\1</a>",$msg);

                // [email=
                $msg = preg_replace("/\[email=(.*)](.*)\[\/email\]/siU","<a href=\"mailto:\\1\">\\2</a>",$msg);

                // [quote]
                $msg = eregi_replace("\[quote\]([^\[]*)\[/quote\]","<BLOCKQUOTE><font size=\"1\" face=\"Verdana, Arial\">[Quote:]</font><hr><i>\\1</i><hr></BLOCKQUOTE>",$msg);

                //
                Code:
                	$msg = eregi_replace("\[code\]([^\[]*)\[/code\]","<pre>\\1</pre>",$msg);
                
                	// Highlight
                		
                	return $msg;
                }
                dann für die ausgabe:

                Code:
                echo ubb($row[6]);
                First: Things get worse under pressure.
                Second: If anything just cannot go wrong, it will anyway
                Third: A falling object will always land where it can do the most damage.

                Comment


                • #9
                  Was ist denn am Lesen verdammt nochmal so schwer, daß Du dafür noch 'nen zweiten Thread anfangen mußt??


                  $text=preg_replace("\[HIGH[\]]([^\[]+)\[[\/]HIGH\]", "'<blockquote>'.highlight_string('\1', true).'</blockquote>'", $text);

                  für soviel Ignoranz sollte man Dich auf die Ignore-Liste setzen!

                  PS.: eregi - Funktionen sollte man eigentlich nicht mehr verwenden weil die langsam sind!
                  carpe noctem

                  [color=blue]Bitte keine Fragen per EMail ... im Forum haben alle was davon ... und ich beantworte EMail-Fragen von Foren-Mitgliedern in der Regel eh nicht![/color]
                  [color=red]Hinweis: Ich bin weder Mitglied noch Angestellter von ebiz-consult! Alles was ich hier von mir gebe tue ich in eigener Verantwortung![/color]

                  Comment

                  Working...
                  X