Step 1 | Please sign in as guest | letmein
or register yourself with an e-Mail address.
Login Name | Password Form
As this is a coding demo and not a real application, let's try and explain some of the basics of what is going on
The code itself is on GitHUb if you wish see this and as this is Step 1, it's been kept very simple. In fact it's really just
an input form with two fields.
1. The DemoLoginController which is invoked by the URL, or this page, calls its index() function which is MVC speak for calling
an index page. This is represented as a function in MVC.
2. Note how the index() calls its own view or sub page and then embeds this into the master-template, so the site keeps its look
and we just create the part of the site/page we need on the main master-page.
3. When the form is submitted it calls its `process me` section, which is also another function in the Controller and this either
moves you onto Step 2 or sends you back to the index page with some issue.
4. This is using page-refresh, i.e. the whole page is being called again. This ISN'T actually how it should be done, but it's how
you start and when it's all working, you then convert to AJAX validation so the page doesn't have to entirely refresh. See later demos.
5. So that it's not completely boring, there is a little AJAX-style drop-box so when you type in an eMail address, it does a fuzzy
search from a DB so that you can see how `features` can be added in. This is again no frills to keep the code simple and could be
As you progess through the sections you'll see more and more advanced techniques and then, if you like, you can have a look at
a full blown APP with lots of tables and clever AJAX and relational DMS.
The structure and style of MVC, as used here, is almost the same for every framework and it really doesn't matter if you use
CI, Laravel, Symphony etc., but once you embrace MVC, and try and stick to the rules, then it really is a better way to code and
over time you'll really enjoy it.
involved. As long as you stick to the structure that your AJAX called PHP code is kept in the controller, you'll be fine, but this
isn't always possible and you might need to write something called a `helper` which is MVC speak for `I'm still using MVC, but
I need to trigger something else when this happens`.