Dit wil niet werken: ( ben nu 2 dagen aant prutsen ermee)
-----------------------
<?php
function template($replace,$source){
$temp = file_get_contents($source);
foreach($replace as $key => $value){
$temp = preg_replace('{'.$key.'}',$value, $temp);
}
return $temp;
}
$array['nieuws_titel'] = 'voorbeeld1';
$array['nieuws_bericht'] = 'voorbeeld2';
$source = "voorbeeld.html";
-----------------------------------------
zo voer ik het uit:
-----------------------------------------
$voorbeeld = template($_POST["voorbeeld"]);
-----------------------
deze errors krijg ik:
------------------------
Warning: Missing argument 2 for template() in /www/htdocs/blabla/add.php on line 10
Warning: Invalid argument supplied for foreach() in /www/htdocs/blabla/add.php on line 12
::: ik heb beide "$replace" al vervangen door $array , maar dat hielp ook niks... ::: whats wrong??