Reputation: 6274
I'm still getting my feet wet in PHP (my 1st language) and I've reached the competency level where I can code one page that handles all sorts of different related requests. They generally have a structure like this:
(psuedo code)
<?php
include 'include/functions.php';
IF authorized
IF submit (add data)
ELSE IF update (update data)
ELSE IF list (show special data)
ELSE IF tab switch (show new area)
ELSE display vanilla (show default)
ELSE "must be registered/logged-in"
?>
<HTML>
// snip
<?php echo $output; ?>
// snip
</HTML>
and it all works nicely, and quite quickly which is cool. But I'm still sorta feeling my way in the dark... and would like some input from the pros regarding this type of page design...
Just curious about what lies ahead, really...
Upvotes: 3
Views: 245
Reputation: 23264
To answer you:
Suggestions from Ivo are good bedtime reading material.
I would also add (as you grow):
Upvotes: 1
Reputation: 5240
This design is what starters go to when they advance a little bit. I went the same way having index.php being one big SWITCH statement calling the appropriate functions and templates based on the URL and parameters. This is very very basic step towards MVC design.
I suggest you to start expanding you knowledge in that direction. Reading more about what MVC (Model-View-Controller), how to create one and maintain it. Then you might be interested in experimenting with some MVC frameworks like CakePHP, CodeIgniter, Kohana...
Here are some articles for you:
Upvotes: 5