Jump to content

template redux


paulmo

Recommended Posts

well, i thought i had this figured out...does $template represent data that would be in a database table, but isn't as it's included now in application file?

 

i'm matching submitted form text against mysql table rows. the replace arrays would not be static with predetermined values: they come from form. 

 

$template = "Cars get us from place to place. The {temp_car} is a good car, {temp_name}. You should drive it.";

$place_holder_array = array();
$place_holder_array[0] = "{temp_car}";
$place_holder_array[1] = "{temp_name}";

$replace_array = array();
$replace_array[0] = "Camry";
$replace_array[1] = "Jim";

$content = str_ireplace($place_holder_array, $replace_array, $template);

Link to comment
https://forums.phpfreaks.com/topic/144524-template-redux/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.