Welcome Guest, Not a member yet? Register   Sign In
jumping into the pool: 1st App
#1

[eluser]number1chump[/eluser]
Hello,


well, today I finished one old style web of mine and managed to try what I most wanted. The MVC OOP waters.

I thought that creating a login page would be pretty much ideal to grasp how this works. I put the connection and queries to the DB in the Models folder, the form with the input fields in the Views and the traffic cop in the Controllers folder. However, some questions arouse:

I created a folder CI within htdocs and that is where I installed CI. Then, I went to the Application folder, and I could see the subfolders of MVC. Fine. But, what about when I want to start another project ? Because if I put all of the files inside their respective MVC folders, what happens with those of the other projects? Do you just create a folder, say "Project1" within M, V and C and then files inside of them?

The second question. Alright I have my (OOP fashion) code to access the DB which I put in the Models folder. I called it login_db.php and then a simple form in the Views that I called login.php and then another file in the Controllers, about which I was asking myself how to write it so that it would call both files and somehow put them together. By just mimic I wrote as this (I know it is not correct after getting the error)

Code:
<?php

class Login extends Controller {

    function Login()
    {
        parent::Controller();    
    }
    
    function login()
    {
        $this->load->view('login.php');
                $this->load->model('login_db.php');
    }
}


And the third question, well, I managed to access the page through the localhost syntax and it was like this http://localhost/ci/index.php/login/login

but it came up with this "foreseen" error

Fatal error: Cannot redeclare Login::login() in C:\xampp\htdocs\CI\system\application\controllers\login.php on line 10

because yes, what I feared, that syntax of declaring it twice cant be.

I think these are easy things yet it is necessary to understand this very core, and so far I am floating in the pool but looking around where to swim to.

If anybody knows the right way to organize files and call them, I would very much be obligued.

best regards

Al


Messages In This Thread
jumping into the pool: 1st App - by El Forum - 10-11-2010, 12:51 PM
jumping into the pool: 1st App - by El Forum - 10-11-2010, 02:37 PM
jumping into the pool: 1st App - by El Forum - 10-11-2010, 03:30 PM
jumping into the pool: 1st App - by El Forum - 10-11-2010, 03:33 PM
jumping into the pool: 1st App - by El Forum - 10-11-2010, 03:35 PM
jumping into the pool: 1st App - by El Forum - 10-11-2010, 03:38 PM
jumping into the pool: 1st App - by El Forum - 10-11-2010, 03:42 PM
jumping into the pool: 1st App - by El Forum - 10-11-2010, 03:54 PM
jumping into the pool: 1st App - by El Forum - 10-11-2010, 03:56 PM
jumping into the pool: 1st App - by El Forum - 10-11-2010, 04:01 PM
jumping into the pool: 1st App - by El Forum - 10-11-2010, 04:02 PM
jumping into the pool: 1st App - by El Forum - 10-11-2010, 04:04 PM
jumping into the pool: 1st App - by El Forum - 10-11-2010, 04:05 PM
jumping into the pool: 1st App - by El Forum - 10-11-2010, 04:13 PM
jumping into the pool: 1st App - by El Forum - 10-11-2010, 04:16 PM
jumping into the pool: 1st App - by El Forum - 10-11-2010, 04:31 PM
jumping into the pool: 1st App - by El Forum - 10-11-2010, 05:01 PM
jumping into the pool: 1st App - by El Forum - 10-11-2010, 05:06 PM



Theme © iAndrew 2016 - Forum software by © MyBB