Hallo Ashura,
> > > > $a=array(
> > > > '%{Datensatz1}',
> > > > '%{Datensatz2}',
> > > > '%{Datensatz3}',
> > > > '%{Datensatz4}',
> > > > '%{Datensatz5}',
> > > > '%{Datensatz6}',
> > > > '%{Datensatz7}'
> > > > );
> > > > $b=hole_daten_aus_db();
> > > > $b=mach_array_draus($b);
>
> > > > echo str_replace($a,$b,file_get_contents('xyz.tpl'));
Wobei sowohl hier als auch in XaraX' Code Redundanz auftritt.
Besser ist deshalb meiner Meinung nach Folgendes:
$str_file = file_get_contents('xyz.tpl');
for ($int_i = 0; $int_i < anzahl_von_wasauchimmer(); $int_i++) {
$str_file = str_replace('%{Datensatz'.$int_i.'}', $b, $str_file);
}echo $str_file
Redundanz? - in dem Fall nur Deine for-Konstruktion die zu allem Überfluß (ach jetzt versehe ich Dich mit Redundanz ;) auch noch Meldungen in Form eines Notice pro Durchlauf auswirft.
Gruß aus Berlin!
eddi
--
Wer Rechtschreibfehler findet, darf sie behalten.