Sorry.
Die Function, welche funktioniert sieht so aus...
PHP-Code:
protected function replaceFunctions()
{
// Neu für php 7
$this->template = preg_replace_callback("/{include file=\"(.*)\.(.*)\"}/",
function ($treffer) {
$aufruf = $this->templateDir.''.$treffer[1].'.'.$treffer[2];
return file_get_contents($aufruf);
}, $this->template);
// Kommentare löschen
$this->template = preg_replace_callback("/<!--(.*)-->/",
function ($treffer) {
return str_replace($treffer[0], "", $treffer[0]);
}, $this->template);
return true;
}
Aktuell hänge ich an dieser Funktion.
PHP-Code:
public function loop($name, $array) {
msg('loop function: '.$name);
/*
Sucht nach Einträgen à la {loop=$name}{/loop} und sendet den Inhalt der Klammern an die Funktion loop_content()
Dabei werden der Name, der "Loop String" und der Datenarray übergeben
*/
$this->template = preg_replace("/".'\{loop="'.$name.'"}'."(.*)".'\{\/loop\}'."/isUe", "\$this->loop_content(\$name, '\$1', \$array)", $this->template);
}
public function loop_content($name, $string, $array) {
$output = '';
$string = stripslashes($string); // Kleiner Fix für den String
foreach($array as $rows) { // Hier geht er den Datenarray durch
$string_tmp = $string; // Clone von $string, damit $string nicht überschrieben wird
foreach($rows as $row) { // Einzelne Objekte werden durchgegangen
/*
Hier werden Werte à la {$name.key} mit den entsprechenden Werten aus dem Array ersetzt
*/
$string_tmp = str_replace($this->leftDelimiter.$name.".".key($rows).$this->rightDelimiter, $row, $string_tmp);
next($rows);
}
$output .= $string_tmp;
}
return $output;
}
Diese bringt weiterhin die Fehlermeldungen...
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /www/htdocs/w0xxxxx/abc/test.de/class/template.php on line 207
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /www/htdocs/w0xxxxx/abc/test.de/class/template.php on line 212
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /www/htdocs/w0xxxxx/abc/test.de/class/template.php on line 225