Mhm mi dice: Object
Ho modificato template.php
Codice PHP:
<?
class sysTemplate
{
var $template;
function sysTemplate($trad=array(),$cache='d_cache.txt',$sec=3600,$tpl='tpl.html')
{
if(!$this->template=$this->r($cache,$sec))
{
(@file_exists($tpl))?$this->template=@file_get_contents($tpl):die('
Attenzione: Il file '.$tpl.' non è presente');
$this->parserT($trad,$cache);
}
}
function parserT($trad,$cache)
{
if(@count($trad)>0)
{
foreach($trad as $t=>$d)
{
$d=(@file_exists($d))?$this->getFile($d):$d;
$this->template=@str_replace('{'.$t.'}',$d,$this->template);
}
$this->buildCache($cache,$this->template);
}else{
die('Attenzione: impossibile eseguire il replace dei tags.');
}
}
function getFile($doc)
{
@ob_start();
include($doc);
$contenuto=@ob_get_contents();
@ob_end_clean();
return $contenuto;
}
function buildCache($cache,$contenuto)
{
$f=@fopen($cache,'w');
@fwrite($f,$contenuto);
@fclose($f);
}
function r($cache,$sec)
{
if(@file_exists($cache)&&@filemtime($cache)>(@time()-$sec))
{
return @file_get_contents($cache);
}
return false;
}
function show()
{
return $this->template;
}
}
?>
e il file home.php
Codice PHP:
<?php
//Recupero il valore di lang
$lang = $_GET['lang'];
//Se la variabile lang è nulla viene selezionata di default
//la lingua italiana (it)
if ($lang == FALSE)
{
$lang = "italiano";
}
//Includo il file di linguaggio interessato
require("{$lang}/home.mo");
//Aggiungo dei link per cambiare la lingua
echo "Scegli lingua:
";
echo "[url='" . $_SERVER[']IT[/url] - ";
echo "[url='" . $_SERVER[']EN[/url]";
@require_once('template.php');
$temp=&new sysTemplate($trad,'cache.txt',86400,'home.tpl.html');
echo $temp;
?>
Mi aiuti a sistemare la faccenda dell'array?