I learned some programming over a decade ago (html, css and php, only a little javascript though), but the web has changed a lot since them.
I want to build myself a website, just a gallery and a simple blog, no other users or anything like that. I’ve tried a couple of different CMS’es over the years, but they’ve either been annoyingly stubborn to work with, didn’t suit my purpose or ended up breaking somehow. I find myself in this odd in-between where I know enough to get things up and running, but not enough to fix them when something goes wrong.
So, I want to go old school, back to basics and just built it myself. It should be possible (plus would be a nice refresher and learning opportunity). I think I’ve got a pretty good handle on the html and css part, but I’m struggling a bit in figuring out how to structure the site and how to store and read data, which is what I’m hoping some of you could help me with.
I don’t want to use a database, mostly because I really like the idea of just opening up VScode, adding or editing a text file, hitting save (I have enabled save-to-server via ftp) and be done with it. I don’t want to log in or use a web-based interface, just write simple text files, manually upload images and add a bit of code where needed to fetch said data.
I imagine having a folder structure like blog > year > row of text files, and in each file have a couple of variables defined with their correlating data like “date”, “title”, “maintext” and so on. Can I use php to fetch the data in these variables from another document? Fx. in blog.php having a piece of code that makes a list (array) of all the text files in the folder, and then for each file output the title and maintext data (aka. have a row of blog posts on the page).
I’m assuming this is possible, but is it the right way to do it? Would javascript be better suited for part of it? Ideally I don’t want to install any libraries or extras on the server, but every guide I’ve come across always includes something like that. I just want to go real simple.
Update: To simplify, what I’m asking is if putting the blog text and relevant data in each their own file, and then fetching the data with php, is a good approach?