-2

Hi I want to create a Template for a Site and I don´t know were this error comes from.

Line 215 is the last line of the code "? >". I already searched for a solution, but I didn´t found the same problem as mine.

Is there anything I didn´t notice?

Thanks

<?php

require_once './Page.php';

class PageTemplate extends Page
{
protected function __construct() 
{
    parent::__construct(); 
}

protected function __destruct() 
{
    parent::__destruct();
}

protected function getViewData()
{
    $sql = "";

    $recordset = $this->database->query($sql);
    if(!$recordset){
        throw new Exception("Abfrage fehlgeschlagen");
    }

    $pizza = array();

    $record = $recordset->fetch_assoc();

    while($record){
        $pizza[] = $record['Pizza'];
        $record = $recordset->fetch_assoc();
    }

    $recordset->free();
    return $pizza;
}

protected function generateView() 
{
    $this->getViewData();
    $this->generatePageHeader('Bestellung');


    echo <<<EOT
    <section role="navigation">
    <nav>
        <ul>
          ...
        </ul>
    </nav>
    </section>

        <section id="content">
            ...
        </section>

    EOT;

    $this->generatePageFooter();
}

public static function main() 
{
    try {
        $page = new PageTemplate();
        $page->processReceivedData();
        $page->generateView();
    }
    catch (Exception $e) {
        header("Content-type: text/plain; charset=UTF-8");
        echo $e->getMessage();
    }
}
}

PageTemplate::main();

? >

1 Answers1

2

I missed it the first time around, and it is quite subtle. The problem is that your EOT; is indented, causing PHP to mis it as the end of the <<<EOF statement.

Daan Meijer
  • 1,324
  • 7
  • 12