ZodiacXP
Erfahrenes Mitglied
Mein PHP: rennt los, stolpert, fällt auf den Kopf, vergisst was aber rennt mutig weiter.
Wie ein kleines Kind.
In $aReplace packe ich zur Zeit 3 Template-Variablen wovon nur eine im Content ersetzt wird. Schreibt man aber in die Schleife so etwas sinnloses wie "echo ' ';" (nur ein Leerzeichen) direkt am Anfang ersetzt er alle.
Wie ein kleines Kind.
PHP:
/**
* Take array-keys as template-variable and replace it with it's content
*
* @param string $sContent The content with template-vars in it
* @param string $aReplace Variables that shall be replaced
* @return string
* @copyright all rigths reserved
*/
function ReplaceTemplateVars($sContent, $aReplace) {
// replace the template-vars - 1.0.0
do {
$sNeedle = TPL_OPEN . key($aReplace) . TPL_CLOSE; // the template-var - 1.0.0
$sContent = str_replace($sNeedle, current($aReplace), $sContent);
} while (next($aReplace));
return $sContent;
}
In $aReplace packe ich zur Zeit 3 Template-Variablen wovon nur eine im Content ersetzt wird. Schreibt man aber in die Schleife so etwas sinnloses wie "echo ' ';" (nur ein Leerzeichen) direkt am Anfang ersetzt er alle.