I'm trying to build a script that will eventually be incorporated into a template editor. The script will take inserted "place-holder" variables, and properly find and convert the "place-holders" into values from a table. That's down the road. Right now I'm trying to build a static script to simulate this process.
On one page I have the following script, attempting to simulate values for the "place-holder" variables. The script is sending them through the class script (2nd below), and should print out the proper value in place of the variable.
When i open Email_Template.php in the browser...I get the following error that refers to the class script (EmailTemplate.class.php) on the final line of code (the last ?> ) I cannot figure out what is wrong - I dont seem to have any missing or duplicate ";" which would be the first thing it seems to be indicating.
Parse error: syntax error, unexpected ';', expecting T_FUNCTION in website.com\EmailTemplate.class.php on line 28
Any help is MUCH appreciated! Thanks!
Email_Template.php
<?
include "EmailTemplate.class.php"; // Email Template class
$tmp=new EmailTemplate(1);
$tmp->setParam('FirstName','John');
$tmp->setParam('LastName','Smith');
$tmp->setParam('PurchasePrice','$1.99');
print $tmp->getText();
?>
EmailTemplate.class.php
<?
class EmailTemplate {
var $params;
var $fields=null;
var $text=null;
function EmailTemplate($templateID){
// connect to db and retrieve template
if($row=$recordset->FetchRow()){
$this->fields=preg_split('/|/',$row['FieldList'], -1, PREG_SPLIT_NO_EMPTY);
} else {
trigger_error('Invalid Email Template ID',E_USER_NOTICE);
}
}
function setParam($name,$value){
if(!isset($this->fields[$name])){
// trigger error
}
$this->params[$name]=$value;
}
function getText(){
// perform search and replace and return text }
} // end class
?>