Mailinglisten-Archive |
On Tue, Aug 06, 2002 at 12:45:45PM +0200, Daniel Lorch wrote:
> hi,
>
> > der teil mit dem ich das templte durch parse :
> > while (ereg("\{([^{}\n]+)\}", $Text, $Replace)) {
> > }
>
> Nimm str_replace() wenn immer möglich. Reguläre Ausdrücke sind LANGSAM - ereg()
> sowieso, setze lieber auf preg_replace().
mmhhh .. ich versteh nicht ganz was ihr meint.
ich laufe mein textfile mit folgendem durch :
while (ereg("\{([^{}\n]+)\}", $Text, $Replace)) { // get the {vars}
$replace = $Replace[1];
$type = type($name);
if ($type == 'Pulldown') {
$Text = str_replace ("{".$replace."}", create_pulldown(), $Text);
}
else {
$Text = str_replace ("{".$replace."}", $value, $Text);
}
das heisst : die ereg funktion findet mir einmal alle strings im text
die so aussehen : {xxx} , dann schau ich mir an was 'xxx' fuer ein type
ist, und ersetze es jendachdem.
womit sollte ich jetzt ereg ersetzen? mmhh.... ich hab das noch nicht so
ganz gecheckt
[ -e n y o- ]
.
--
Lying increases the creative faculties, expands the ego, and lessens the
frictions of social contacts.
-- Clare Booth Luce
php::bar PHP Wiki - Listenarchive