If we are using more than one table in database, we need to make sure that they have relationship with each other.
I decided to do it with ‘ID’ which means that all my tables that I want to use have to have ‘ID’ and Category_ID in as you can see on the pictures belove –
The big mistake I made earlier when I tried to create CMS and it wasn’t working properly was that I didn’t know about relational tables and I put different ID names in each table. Please click here to read my post about it.
In my previous post I was talking about CMS that was not working. Problem is solved!
What was the problem
The problem was in function
In my code, there was capital ‘ID’ which is old way of doing it and that is why it was not working. The reason why I had capital ID there was in my tables and I thought everywhere it had to be capital.
Function is always with lowercase ‘id’!
I created CMS where users can log in, see all posts, add/delete posts, create categories, and also edit posts.
All of them works perfectly fine apart from edit posts option. I, lecturer and a few friends spent so many hours trying to figure out why it is not working but the final result is to start building it from the beginning as no mistake was found but it is still not working. Possibility might be corrupted files as I made massive and dragged files around and that way full website can fall apart! NEVER NEVER NEVER DRAG FILES FROM LOCAL TO REMOTE!!!!
What it is doing
When you point with cursor on ‘edit’, you can see that id is called from table and also after clicking on ‘edit’, URL shows the right id from table but text is not pulled out so we end up with empty form.
My next step is to start building CMS all over again.
One of requirements for this project is to have CMS in the website so users (only users with username and password!) can manage content of the site.
I decided to put this option to the footer as it is important only for the right users and it is not in the way of design.
THERE IS NO CSS ADDED TO CMS YET! AS I WANTED TO MAKE SURE IT WORKS FIRST!!!
After clicking on ‘ADMIN‘ users will get new window asking them to sign in –
After logging in –
Users will get this choice of how to manage content of the website –
User will be able to view all current posts by clicking on ‘home’ –
Add post –
After clicking on ‘Add’, they will be able to see recently added post straight away like this in ‘manage posts’ –
Choice of editing or deleting is under posts and gives users easy manageable option to use CMS.
Delete option is secured with pop out window asking users if they are sure they want to delete this post. This option is provided to avoid users deleting posts accidentally –
This is folder structure for The 4 elements website –
I decided to validate the 4 elements website while it was still in the making process to avoid any errors and mistakes later on. I was quite lucky as I got only one warning and one error –
There were –
Using frame boarder attribute is obsolete and that is why I will have to change it to CSS. This is my next task as I want to make sure that the code is valid.