So I'm about to make a template that will be the homepage of my upcoming site. How can I make it so that I can have like a little backend that I can edit the text on certain parts of the site instead of editing the html directly. Like basically store information in the database rather on file. Can I see an example of php coding I can use?
I would recommend using a content management system like Wordpress, Drupal, or Joomla to handle this for you. All you need to do is install Wordpress and then make alterations to a default theme to look how you'd like your site to look.
If you really, really wanted to write your own back-end, then you'd need to:
1. Have a login page where you enter a password. You can google how to create a simple PHP login page
2. Have a page that checks whether you are logged in (the tutorial you find in step 1 should tell you how to do that), and if you are logged in, shows a forum to edit the pages.
3. Have a page which takes the stuff the user typed into the form, and saves it into a database using MySQL queries
4. On the site homepage, use MySQL queries to load the data from the database and display it.
But, as I said, using wordpress is much, much easier, and more secure.
Thanks Cosmic, but this is mainly for a personal project so I can learn PHP more efficiently. I will try this method, I'll post back here if I need anymore help. I just needed someone to list the steps like how you just did, thanks.
it is best to use smarty, a php template engine. using this you can separate the php login from the design.
If that is too complex for you right now i suggest a header and footer file that loads the design and specific vars that will be used in the design elements.
I have tutorials on this type of thing on my website codervault. you can find the link in my signature, just click the banner.