Announcement

Collapse
No announcement yet.

Create Class Help

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Create Class Help

    require('c:\FPDF\fpdf.php');

    class PDF extends FPDF
    {
    // Cabecera de página
    function Header()
    {
    // Logo
    $this->Image('logo_pb.png',10,8,33);
    // Arial bold 15
    $this->SetFont('Arial','B',15);
    // Movernos a la derecha
    $this->Cell(80);
    // Título
    $this->Cell(30,10,'Title',1,0,'C');
    // Salto de línea
    $this->Ln(20);
    }

    // Pie de página
    function Footer()
    {
    // Posición: a 1,5 cm del final
    $this->SetY(-15);
    // Arial italic 8
    $this->SetFont('Arial','I',8);
    // Número de página
    $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
    }
    }

    // Creación del objeto de la clase heredada
    $pdf = new PDF();
    $pdf->AliasNbPages();
    $pdf->AddPage();
    $pdf->SetFont('Times','',12);
    for($i=1;$i<=4;$i++)
    $pdf->Cell(0,10,'Imprimiendo línea número '.$i,0,1);
    $pdf->Output();


    I have a Application type Blank, when eject the application show me :
    Fatal error: Class declarations may not be nested in C:\Program Files\NetMake\v7\wwwroot\scriptcase\app\reporteGas tos\blank\index.php on line 919

    are where define my class ??

  • #2
    You can do that in a librarie for instance. But more important you are creating a class of name PDF. Now I'm not sure, but if SC is using the same class name you might run into conflicts. As fpdf is part of the sc librarie the declaration (require) might not be necessary. But to prevent double inclusion you might try require_once. Just things to try I guess.
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development
    www.scriptcase.eu / www.scriptcase.nl

    Comment


    • #3
      I made a step by step how to solve it!

      http://www.scriptcase.net/forum/show...highlight=FPDF

      Comment


      • #4
        I want help for some classes Lets see them, tell me what all your custom classes are. 10 Points to the 5 i like best. Heres how you do
        matrimonial sites for Kumaonis | Matrimonial Sites |

        Comment


        • #5
          Lets see them, tell me what all your custom classes are. 10 Points to the 5 i like best. Hermes how you do
          matrimonial sites for Kumaonis | Matrimonial Sites |

          Comment

          Working...
          X