-2

I am getting this error:

    An uncaught Exception was encountered
Type: ParseError

Message: syntax error, unexpected '$data' (T_VARIABLE), expecting function (T_FUNCTION)

It says it's at line 32, here is my controller

<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Page extends CI_Controller {

    public function index($slug = NULL){
        if($slug){
                $this->db->where('p_slug', $slug);
        }else {
            $this->db->where('p_frontpage', 1);
        }

        $sqlQuery = $this->db->get('pages');

        $data = $sqlQuery->row_array();
        $data['page_title'] = "Aske's side";
        $data['nav'] = $this->db->get('pages')->result_array();

        $this->parser->parse('template/header', $data);
        $this->parser->parse('template/banner', $data);
        $this->parser->parse('template/footer', $data);
        $this->parser->parse('view_page', $data);

    }
    public function create(){
        //Test af formular
        if ($this->input->post()) {
                echo "test";
            }
        }
        //Globale elementer
        $data['page_title'] = "Aske's side";
        $data['nav'] = $this->db->get('pages')->result_array();
        //Templates til admin
        $this->parser->parse('template/header', $data);
        $this->parser->parse('template/banner', $data);
        $this->parser->parse('template/footer', $data);
        $this->parser->parse('create_view', $data);
    }
}

So the controller is loading 2 views, view_page.php & create_view.php, but I can't go any further with this error. I hope someone can help me here.

Thank's in advance.

KR Aske

askemerci
  • 3
  • 3

1 Answers1

5

You have an extra closing bracket on the create method.

Iñigo Ochoa
  • 130
  • 7