I thought I could share some doubts I'm having while projecting and developing a new website.
The reasons I'm posting here are:
- you may be so kind, and knowledgeable enough, to answer my questions
- phpBB3 behavior is what mainly triggered such questions.
These pages are mainly static (in fact they are pure HTML pages now), so it's "create once, use many times". Also, many of them are not "monolithic pages", but rather a list of "items" - jokes, for example, or aphorisms.
To cut the story short, there are basically two ways of doing things:
- having separate .html files containing all the items for that page, simply include()'d or file_get_contents()'d+echoed (wow, sorry for the neologisms) into php pages;
- having the items stored in a database and retrieved by PHP with SELECT queries.
I mean, databases are great for handling huge numbers of little pieces of information, or different operations over them (read, add, modify, etc.), searches, and performing complex operations on such data or intersection/concatenation/elaboration of data from different tables; but it shouldn't be better when it comes to just retrieving a bunch of lines from one table record.
BUT! phpBB3 stores entire stylesheets, images, and template files into the database, and uses it instead of files. Why is this done? For efficiency sake, or other reasons?
To sum it up, my questions are (generally speaking): if I have to include 50 out of 200 items in my page, and I have
- one database table containing one record for each item;
- one html page containing all 200 items;
- four html pages containing each 50 items (one of them contains the 50 I need);
- 200 html pages each containing one item;
- a 50-record select plus elaboration, echo, etc., or a straightforward single file inclusion?
- a 50-record select etc., or a file reading plus slicing it to obtain the 50 items I need?
- a 50-record select etc., or the inclusion of 50 html files? (this is out of curiosity, as I won't of course do this)
Any input will be welcome.