Mailinglisten-Archive |
sorry, ich hab meine frage nicht genau genug gestellt :(
hier nochmal
===============================================================
<?php
$x = '<html>
<head>
</head>
<body>
hier steht: {LANG_TEXT1} und hier <b>{LANG_TEXT2}</b><br />
ein bild: <img onClick="return false;" src="http://testo.de/img.gif?text={LANG_TEXT3}"><br />
ein button: <input type="image" src="{BUTTON}{LANG_TEXT4}"><br />
</body>
</html>';
$x = preg_replace( "/(>[^<]*\{(LANG_.*?)\})/", "$1{EDIT_$2}", $x );
$x = preg_replace( "/(<[^>]*\{(LANG_.*?)\}.*?>)/", "$1{EDIT_$2}", $x );
echo $x;
?>
===============================================================
OUTPUT:
<html>
<head>
</head>
<body>
hier steht: {LANG_TEXT1}{EDIT_LANG_TEXT1} und hier <b>{LANG_TEXT2}{EDIT_LANG_TEXT2}</b><br />
ein bild: <img onClick="return false;" src="http://testo.de/img.gif?text={LANG_TEXT3}">{EDIT_LANG_TEXT3}<br />
ein button: <input type="image" src="{BUTTON}{LANG_TEXT4}">{EDIT_LANG_TEXT4}<br />
</body>
</html>
?>
===============================================================
der ist auch korrekt, aber:
<?php
$x = '{LANG_TEXT1}';
$x = preg_replace( "/(>[^<]*\{(LANG_.*?)\})/", "$1{EDIT_$2}", $x );
$x = preg_replace( "/(<[^>]*\{(LANG_.*?)\}.*?>)/", "$1{EDIT_$2}", $x );
echo $x;
?>
===============================================================
OUTPUT:
{LANG_TEXT1}
da sollte aber eigentlich:
{LANG_TEXT1}{EDIT_LANG_TEXT1}
stehen!!!
danke nochmal
php::bar PHP Wiki - Listenarchive