Welcome Guest, Not a member yet? Register   Sign In
Message: Constant EXT already defined
#1

[eluser]buckboru[/eluser]
I am going through a simple todo list tutorial and receiving the following.
I received this on another tutorial and just gave up because i couldn't find a resolution.
Can someone tell me what the cause of this is and how to avoid it?

Thanks

Here are my files.
Controller:
Code:
<?php
class Todo extends Controller {

    public function __construct()
    {
        parent::__construct();
        $this->load->model('Todo_model');
        $this->load->database();
    }

    function index()
    {
        $data['todo_list'] = $this->Todo_model->getNextTodo();
        $data['completed_list'] = $this->Todo_model->getCompletedTodo();
        $this->load->view('todo/index', $data);
    }
}
?>
MODEL:
Code:
<?php
class Todo_model extends Model {

    public function __construct()
    {
        // model constructor
        parent::__construct();
    }
    
    function getCompletedTodo()
    {
        $query = $this->db->get_where('tstmis.todo', array('STATUS' => 0));        
        return $query->result();
    }
    
    function getNextTodo()
    {
        $query = $this->db->get_where('tstmis.todo', array('STATUS' => 1));    
        return $query->result();
    }
}
?>
VIEW
Code:
<html>
    <head>
        <title>CodeIgniter To Do List Application</title>
    </head>
<body>

<h1>Welcome to CodeIgniter To Do List Application!</h1>

<h2>Next</h2>
&lt;?php if($todo_list): ?&gt;
<ul>
    &lt;?php foreach($todo_list as $todo): ?&gt;
    <li><h3>&lt;?= $todo->name ?&gt;</h3>
    &lt;?php if($todo->description): ?&gt;<p>&lt;?= $todo->description ?&gt;</p>&lt;?php endif ?&gt;
    </li>
    &lt;?php endforeach ?&gt;
</ul>
&lt;?php else: ?&gt;
None
&lt;?php endif ?&gt;

<h2>Completed</h2>
&lt;?php if($completed_list): ?&gt;
<ul>
    &lt;?php foreach($completed_list as $todo): ?&gt;
    <li><h3>&lt;?= $todo->name ?&gt;</h3>
    &lt;?php endforeach ?&gt;
</ul>
&lt;?php else: ?&gt;
None
&lt;?php endif ?&gt;
&lt;/body&gt;
&lt;/html&gt;
#2

[eluser]pistolPete[/eluser]
EXT is defined in index.php:

Code:
/*
| EXT        - The file extension.  Typically ".php"
*/
define('EXT', '.'.pathinfo(__FILE__, PATHINFO_EXTENSION));

Which CI version are you using? Did you modify the index.php?
#3

[eluser]buckboru[/eluser]
Thanks for the reply.
I'm running 1.7.0
I have not modified the index.php file at all.
#4

[eluser]buckboru[/eluser]
Update on this.
my view is in folder(todo) and named index.php.

Because the issues seemed to be with index.php, i renamed my view from index.php to todoview.php and it worked.

So is it a bad idea to name anything other than maybe the main controller as index.php?????




Theme © iAndrew 2016 - Forum software by © MyBB