Hallo,
so die Meldung aus:
Fatal error: Call to a member function setTitel() on a non-object in --- line.77
was ich net verstehe ist, was das bedeutet und wo ich den Fehler mache.
PHP
<?php
require_once ('class_artikel.php');
require_once ('class_pdf.php');
class webshop extends artikel
{
private $pdf;
public function __construct($dateiname)
{
parent::__construct($dateiname);
}
public function auswahl()
{
if (count($this->korb) > 0)
{
print "<table>";
print "<tr>\n <th>Artikel</th><th>Anzahl</th>\n </tr>\n";
foreach($this->korb as $key => $value)
{
print "<tr>";
print "<td>".$this->artikelArray[$key]['name'].
"</td><td>".$value."</td>\n";
print "</tr>";
}
print "</table>";
}
else
print "Keine Artikel im Warenkorb gefunden.";
}
public function anzeigen()
{
print "<table>";
print "<tr>\n <th>Artikel</th><th>Preis</th> <th></th>\n </tr>\n";
foreach ( $this->artikelArray as $key => $value )
{
print "<tr>\n";
foreach ( $value as $subKey => $subval )
{
if ( $subKey == "name")
{
print "<td>".$subval."</td>";
}
else
{
print "<td>".$subval." €</td>";
print "<td><a href=\"".$_SERVER['PHP_SELF']."?id=".$key.
"\">in den Warenkorb</a></td>\n";
}
}
print "</tr>\n";
}
print "</table>\n";
}
public function setArtikel($daten)
{
$this->pdf->SetLeftMargin(35);
$this->pdf->Cell(30,5,"Artikelnummer",1,0,'C');
$this->pdf->Cell(60,5,"Artikel",1,0,'C');
$this->pdf->Cell(30,5,"Preis",1,0,'R');
foreach($daten as $key => $value)
{
$this->pdf->In();
$this->pdf->Cell(30,5,$key,1,0,'C');
$this->pdf->Cell(60,5,iconv('UTF-8', 'ISO-8859-15',
$value['name']),1,0);
$this->pdf->Cell(30,5,$value['preis']." Euro",1,0,'R');
}
}
public function pdfliste()
{
$this->pdf->setTitel("Liste der bestellbaren Artikel");
$this->pdf->AliasNbPages();
$this->pdf->AddPage();
$this->pdf->SetFont('Times', '', 12);
$text = "Sehr geehrter Kunde,\n\nVielen Dank, dass Sie sich".
" für unser Angebot interessieren. Folgende Artikel".
" können Sie in unserem Online-Shop (http://".
$_SERVER['HTTP_HOST'].") bestellen.\n";
$this->pdf->setText($text);
$this->setArtikel($this->artikelArray);
$text = "\n\nVielen Dank für Ihr Interesse.";
$this->pdf->setText($text);
$this->pdf->Output();
}
}
?>
Alles anzeigen
und die Andere Class
PHP
<?php
require_once("fpdf/fpdf.php");
class pdf extends FPDF
{
private $Seitentitel;
public function Header()
{
$this->SetFont('Arial','B',15);
$this->Cell(80);
$this->Cell(30, 10, $this->Seitentitel, 0, 0,"C");
$this->Line(5,23,205,23);
$this->Ln(20);
}
public function setText()
{
$this->SetLeftMargin(30); #setzt Rand
$this->Write(5, iconv('UTF-8', 'ISO-8859-15', $text));
$this->In();
}
public function setTitel($text)
{
$this->Seitentiteltitel = $text;
}
}
?>
Alles anzeigen
wär spitze wenn ihr mir Helfen könntet.
Danke ticco