#!/usr/bin/env php $name) { $data[$id]['name'] = $name; foreach (array('humidity', 'temperature') as $item) { $lu = rrd_lastupdate( str_replace( array('{item}', '{id}'), array($item, $id), $filetemplate ) ); if ($lu === false) { throw new Exception(rrd_error()); } $data[$id][$item] = reset($lu['data']); } } foreach (glob(__DIR__ . '/templates/*.php') as $tplfile) { $outfile = $outdir . basename($tplfile, '.php'); ob_start(); include $tplfile; $content = ob_get_contents(); ob_end_clean(); file_put_contents($outfile, $content); } ?>