I Love Learning!
Well I've been working with a few folks just starting out learning PHP and they've insisted on starting right from the basics.
I've also been keeping my hand in brushing up on my Codeigniter skills and just recently ventured into the exciting world of Laravel! PHP Frameworks are great things.
Going back to website basics!
Well I should begin by saying, I've been putting websites together for a few years now.
But the problem has been, I must have some fancy script to achieve this.
So today I decided, why not go back to basics and see how long it would take me to come up with something very basic, from scratch.
So for reasons unknown, I've gone with two sidebars. [Update: I went back to 1 Sidebar because it got too messy.] But that begs the question..."What for?". What does one put in a sidebar anyway?
Well they are good for placing links and things to help show the visitor (You!) what is on the website so you can go clicking about the site and frowning
from reading all the other junk I write.
Ok so one of the problems faced by a File Based website is, how to add pages?
Well this is where the thinking cap has to come out and some thought has to put into it.
At the moment we have a single index.php file that is acting as the sites "template" and it contains
a lot of "includes" that pull in the appropriate files from the views folder that contains the sections of the page.
Going back to website basics!
So we are continuing along with our File Based Blog and one apparent issue that crops us is how to arrange the order of
the articles when listing them on the main page. There is also the issue on how to only show so many characters of each post (but we have kind of catered for that already).
As I am intending to show lots of code examples on this site, it is important to have something that makes the code easy to read.
Version of this sites index.php "route / view" handler
Hmm, well as part of any good blog, I have put in the comments bits, but due to the nature of the site, I am not going to be enabling those any time soon. The reason being, it's got it's own set of issues to deal with. Remember that this site in its current format has NO DATABASE.
The whole how do I deal with accepting user input and policing it in a system like this can be done, ( anything
can be done with a little thought) , but not until I get this thing settled down a bit more.
Teach yourself how to learn!
Right, now this one of my most biggest, largest "things" a person can have and of course I have got a strong opinion on it mainly due to my own disability at time, where I can be reading something and it goes in one eye and out the other...
And I must add one other thing... If you do ever get the chance to speak to me, well I'll warn you now.
When learning to program, it is really important to understand the basics!
So let's get into it.
First rule: There is always more than one way to do something.
The way you choose is as good a choice as any, if it works correctly. The best thing you can do is to get it working first.
BUT you can always ask yourself, and you should all the time... "Can I make this simpler?" and "Is this the best way to do this?", but don't let that get in the way of getting something working first!
So having said that... Let's continue on.
The Displaying of entries from a Database is a wonderful thing. But how do you easily edit them?
So lets say you had something like this...
This is a simple table where each table cell is a form text input. Why were form text inputs chosen? Well only because it gives us a simple way to edit an entry. Also, the person asking for help on this had already decided on this method, so I thought, let's stick with it and see how it plays out!
As you do this a few times, you will see, that there is a nice simple "recipe" that you will find, that allows you to work through these issues.
Starting from the Top!
So to perform this investigation, we need to come up with a script that will allow us to emulate the problem at hand and allow us to test things out. In other words, a playpen!
So we'll need an index.php file and why not make this a proper HTML page where we can display our table.
Here is the index.php file!
This is a direct copy of the boiler plate code (Basic Template) from Bootstrap