Salve, sto modificnado lo scirpt per i bbcode, ma ho un errore alla riga 36 l'errore è:
Parse error: syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in /membri/zomer/bbcode.php on line 36
invece la sorgente:
Codice PHP:
<?php
function immagine($immagine){
$resize ='400';
$cosa = getimagesize($immagine);
$width = ($resize < $cosa[0]) ? $resize : $cosa[0];
echo '<img src="'.$immagine.'" width="'.$width.'" alt="'.$immagine.'">';
}
function bbcode_format($var) {
$search = array(
"/\[center\](.*?)\[\/center\]/is",
"/\[b\](.*?)\[\/b\]/is",
"/\[i\](.*?)\[\/i\]/is",
"/\[u\](.*?)\[\/u\]/is",
"/\[url\](.*?)\[\/url\]/is",
"/\[url\=(.*?)\](.*?)\[\/url\]/is"
);
$replace = array(
'<center>$1</center>',
'<strong>$1</strong>',
"<em>$1</em>",
"<u>$1</u>",
'<a href="$1">$1</a>',
'<a href="$1">$1</a>'
);
while(preg_match("#\[quote\](.*?)\[\/quote\]#is", $var)!=0)
$var = preg_replace("#\[quote\](.*?)\[\/quote\]#is", '<table border="1"><tr><td>$1</td></tr></table>', $var);
while(preg_match("#\[img\](.*?)\[\/img\]#is", $var)!=0)
$img = preg_replace("#\[img\](.*?)\[\/img\]#is", immagine($1), $var);
$var = preg_replace($search, $replace, $var, $img);
return $var;
}
?>