Thanks for the feedback! >From the docs it appears that I can do this: $string = file.tpl; //html mixed with {placeholders} $array = fetch_mysql_array($result, MYSQL_ASSOC); //array of field => values echo strtr($string, $array); //passing only 2 arguments means 2nd is array one thing - I want to use special {} characters in my file.tpl. Does anyone know if there is some way I can tell strtr to only evaluate items in {} tag for replacing? regards, jaxon On 2/8/01 5:49 PM, "Brad S. Jackson" <[EMAIL PROTECTED]> wrote: > > > See the documentation for strtr and preg_replace. > > http://www.php.net/manual/en/html/function.strtr.html > http://www.php.net/manual/en/html/function.preg-replace.html > > > "Jaxon" <[EMAIL PROTECTED]> wrote: > Hi > > Can I do this???? > > $string = file.tpl; > > while (list($pattern, $replacement) = each($array)) { > ereg_replace ($pattern, $replacement, $string); > } > > echo $string; > > > > note some assumptions below: > > $array contains an assoc array: > > first foo > second bar > third rab > fourth oof > > file.tpl is this: > > some html {first} > more html {second} > even more html {third} > lots more html {fourth} > > This seems like a slow way to do this... > any advice is welcome! > > tia! > jaxon > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]