First, create a template object: $tem = new Tem(); Then, load a template file (note: this can be done after you put the values in) $tem->load('template.html'); # or $tem->load_str("""