PageSubclass_Controller

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?PHP
    public function index()
    {
        $projects = DataObject::get_by_id('Page', 2);
        $contact = DataObject::get_by_id('Page', 3);
        // Required for the template to output the contact form.
        $contactController = new UserDefinedForm_Controller($contact);

        return $this->customise(array(
            'Projects' => $projects,
            'Contact' => $contact,
            'ContactController' => $contactController,
        ));
    }
?>

Template (html)

1
2
3
4
5
6
7
<h2>$Contact.Title</h2>
<div class="form">
        <% if formFinished %>
            $Contact.OnCompleteMessage
        <% end_if %>
        $ContactController.Form
</div>