-
Notifications
You must be signed in to change notification settings - Fork 0
/
myTemplate.php
38 lines (31 loc) · 924 Bytes
/
myTemplate.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
class myTemplate {
private $templateFileContents;
private $arrPairs;
public $translation;
public function formCreate($title) {
$this->formContent="";
$this->formFields = array();
$this->formAdd("$title", "LBL");
}
public function __construct($templateFile=null, $arrPairs=null){
$translation = "";
if($templateFile!==null){
$this->readTemplate($templateFile);
}
if(is_array($arrPairs) && (strlen($this->templateFileContents)>0)){
$this->arrPairs = $arrPairs;
$this->translate();
}
}
public function translate(){
// print_r($this->templateFileContents);
// print_r($this->arrPairs);
$out = strtr($this->templateFileContents, $this->arrPairs);
// print_r($out);
$this->translation = $out;
}
public function readTemplate($templateFile){
$this->templateFileContents = file_get_contents($templateFile);
}
}