[ yot | yob ] [ Home | Admin | Hilfe ]
but you get no face 

Antwortmodus

 Zum Löschen
Regeln
  • Erlaubte Formate: GIF, JPG, PNG
  • Maximale Dateigröße: 4.096 Kb
  • Bilder über 300 x 300 Pixel werden verkleinert (Antworten 200 x 200)
  • Lies diese Regeln und FAQ vor der Teilnahme
  • Erlaubter BBCode: [b][i][u][s]
  • Die Inhalte dieser Seite sind prinzipiell nicht ernst zu nehmen
  • 97 Posts mit 49 Bildern in 25 Threads von 37 Besuchern
>>>>>>

 [ zurück ]

functions.php

(10.11 Kb, 500 x 216, case code.png) 1266394175710.png
Anonymous 17.02.10 (Mi) 08:09 Nr.4  
Damit der Code-bbCode funktioniert, muss in functions.php die Funktion function com_BBCode () aktualisiert werden, neu ist der

case 'code'


Hier die ganze neue Funktion

function com_BBCode ($mixedInfo) {
 $stringCode = '';

 $arrayParameter = array ();

 $booleanMixedInfoIsArray = FALSE;

 if (is_array ($mixedInfo) === TRUE AND count ($mixedInfo) == 4 ) {
  $stringText = $mixedInfo[3];
  $stringCode = strtolower ($mixedInfo[1]);
  $arrayParameter = functionParseParameter ($mixedInfo[2]);
  $booleanMixedInfoIsArray = TRUE;
 }
 elseif (is_string ($mixedInfo) === TRUE) {
  $stringText = $mixedInfo;
  $stringText = preg_replace ('%\[(br|hr)]%is', '[\1][/\1]', $stringText );
 }
 else {
  return '';
 }

 if ($stringCode != 'noparse') {
  $stringText = preg_replace_callback ('%\[(\w+)((?:\s|=)[^]]*)?]((?:[^[]|\[(?!/?\1((?:\s|=)[^]]*)?])|(?R))*)\[/\1]%', 'com_BBCode', $stringText );
 }

 if ($booleanMixedInfoIsArray === TRUE) {
  switch ($stringCode) {
   case 'b':
   case 'i':
   case 'u':
   case 's':
   { $stringText = '<'.$mixedInfo[1].'>'.$stringText.'</'.$mixedInfo[1].'>';
   break;
  }

  case 'noparse':
  { break;
 }

 case 'spoiler':
 { $stringText = '<span style="background-color:#010101; color:#010101;" onmouseover="this.style.color=\'inherit\'; this.style.backgroundColor=\'inherit\';" onmouseout="this.style.color=\'#010101\'; this.style.backgroundColor=\'#010101\';">' . $stringText . '</span>';
}

case 'code':
{ $stringText = ' <b>Code:</b> <div class="code">' . $stringText . '</div>';
break;
}

default:
{ //  $stringText = $mixedInfo[0];
break;
}
}
}

return $stringText;
}
>>
Anonymous Nr.5
>>4 wichtig ist das kleine

break;

in der Funktion. Dieses verhindert, dass die Sonderzeichen zu htmlentities verarbeitet werden. Wenn das break fehlt, dann wird das Sonderzeichen
'<'
beispielsweise zu
'<'
dann das Ergebnis erneut zu htmlentities, also zu
'&lt;'
und dann nicht mehr für Menschenaugen lesbar. Das 'break;' bricht die Umwandlung ab.
>>
Anonymous Nr.6
>>4
As you can see, I created a new css class named "code"

case 'code':
{ $stringText = ' <b>Code:</b> <div class="code">' . $stringText . '</div>';
break;
}


you now can easily style it, as I did in global.css. Here I created two classes, one for threads and one for replies.
Both, say, with a red border. Add to global.css

.reply .code {
 
 border:1px solid #CC1105;
 
 margin:5px;
 
 }
.thread .code {
 
 border:1px solid #CC1105;
 
 margin:5px;
 }


or add that new classes to every css file you want to.
>>
Newbieey Nr.12
(9.32 Kb, 152 x 87, Bildschirmfoto 2010-(…).png) 1266546098472.png
AH!

PS: MOVE TO THE CSS-THREAD
>>
Newbieey Nr.13
>>12
> “”

can we have a move-function?
>>
Anonymous Nr.80
(236.56 Kb, 1024 x 807, AC2K repros 6.jpg) 1303014278204.jpg
I finally implemented the 'Code'-BBcode-Code; thanks for the hard coding and the detailled explenation.
Keep up the good work.

Passwort    [  ] 
[ zurück ]
[ Home | Admin | Hilfe ]