Udsrive værdi til tabel
HejJeg har brug for hjælp til at udskrive 5 værdier til en tabel. Med en klasse. Jeg skal udksrive:
$_SESSION['kurv']['id'][$i];
$_SESSION['kurv']['beskrivelse'][$i];
$_SESSION['kurv']['antal'][$i];
$_SESSION['kurv']['pris'][$i];
$_SESSION['kurv']['url'][$i];
Jeg bruger af klasse:
<?PHP
class Tabel
{
var $template;
function tabel ($path)
{
$this->template = file_get_contents($path.'template/kurv.tpl');
}
function Setid($id)
{
$this->template = str_replace('{ID}', $id, $this->template);
}
function Setbeskrivelse($beskrivelse)
{
$this->template = str_replace('{BESKRIVELSE}', $beskrivelse, $this->template);
}
function Setantal($antal)
{
$this->template = str_replace('{ANTAL}', $antalr, $this->template);
}
function Setpris($pris)
{
$this->template = str_replace('{PRIS}', $pris, $this->template);
}
function Seturl($url)
{
$this->template = str_replace('{URL}', $url, $this->template);
}
function Setmoms($moms)
{
$this->template = str_replace('{MOMS}', $url, $this->template);
}
function Setantalialt($antalialt)
{
$this->template = str_replace('{ANTALIALT}', $antalialt, $this->template);
}
function Setprisialt($prisialt)
{
$this->template = str_replace('{PRISIALT}', $prisialt, $this->template);
}
function Create()
{
return $this->template;
}
}
?>
Template:
<table border="1" cellspacing="0" cellpadding="0" width="50%">
<tr>
<td>Varernummer</td>
<td>Beskrivelse</td>
<td>antal</td>
<td>pris</td>
<td>Slet</td>
</tr>
<tr>
<td>{ID}</td>
<td>{BESKRIVELSE}</td>
<td>{ANTAL}</td>
<td>{PRIS}</td>
<td>{URL}</td>
</tr>
<td colspan="5"><hr></td>
</tr>
<tr>
<td>I alt:</td>
<td>{MOMS}</td>
<td align="right">{ANTALIALT}</td>
<td colspan="2" align="right">{PRISIALT}</td>
</tr>
</table>
