AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren

[PHP] Konstante in Klasse

Ein Thema von Luckie · begonnen am 7. Jul 2009 · letzter Beitrag vom 13. Jul 2009
 
Benutzerbild von Luckie
Luckie

Registriert seit: 29. Mai 2002
37.621 Beiträge
 
Delphi 2006 Professional
 
#1

[PHP] Konstante in Klasse

  Alt 7. Jul 2009, 13:20
Ich habe hier eine PHP-Klasse mit einer Konstanten:
Code:
class CreatePDF
{
    const CORRECTION_FACTOR_MAXCELLROWS = 1.60; // just a workaround
Wenn ich selbige aber benutzen will, sagt er mir, dass er sie nicht kennen würde:
Code:
    private function getMaxTextLinesForRow($i, $trans)
    {       
        return max(
            $this->pdf->getNumLines((string)$i+1, $this->colWidths[0]),
            $this->pdf->getNumLines($trans['Position'][(string)$i]['title'], $this->colWidths[1]),
            $this->pdf->getNumLines($trans['Position'][(string)$i]['description'], $this->colWidths[2]),
            $this->pdf->getNumLines($trans['Position'][(string)$i]['net_price'], $this->colWidths[3]),
            $this->pdf->getNumLines($trans['Position'][(string)$i]['amount'], $this->colWidths[4]),
            $this->pdf->getNumLines($trans['Position'][(string)$i]['amount']*$trans['Position'][(string)$i]['net_price'], $this->colWidths[5]),
            $this->pdf->getNumLines($trans['Position'][(string)$i]['tax_type'], $this->colWidths[6]),
            $this->pdf->getNumLines((1-$trans['Position'][(string)$i]['tax_type']/100)*$trans['Position'][(string)$i]['amount']*$trans['Position'][(string)$i]['net_price'], $this->colWidths[7])
            ) * $this->CORRECTION_FACTOR_MAXCELLROWS;
    }
Zitat:
Undefined property: CreatePDF::$CORRECTION_FACTOR_MAXCELLROWS [APP\views\transactions\createpdf.php, line 154]
Aber laut einem PHP Tutorial werden in Klassen Konstanten mit const deklariert und nicht mit define.
Michael
Ein Teil meines Codes würde euch verunsichern.
  Mit Zitat antworten Zitat
 

Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 07:38 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz