Welcome to WebmasterWorld Guest from 18.104.22.168
I want to be able to control the number of records displayed per page on the backend CMS page where I add/edit entries in the database, and I'm wondering if it's necessary to set up and entire table in the DB for that one value or if I should do something like set up a simple text file with the value in it that is opened and edited with the file functions like fopen, fwrite, and such.
I feel like there is probably a very simple way to do this and I'm going the long route here.
I'm wondering if it's necessary to set up and entire table in the DB for that one value or if I should do something like set up a simple text file....
If this is your only value, text is fine - however - if you have an administrative back end, you are very likely to have at least a few and should have a LOT of configurable variables.
- per_page (the one of which you speak)
- Page titles - what if the owner wants to change their shopping cart heading from "Shopping Cart" to "Shop for Widgets?" And . . . they don't know how to, or you don't want them futzing around with, the HTML/PHP?
- Owner email, for responses, email functions . . .
- company name, number, address for display in various places . . .
- CSS selector names used by your scripts, so these can be changed if the owner experiments with different styles
You get the picture. One of the biggest problems I have with most existing code I'm asked to "fix" - nearly all of it has hard-coded values in places that should be variables that are either set at the head of a global include or extracted from a database.
If you extract them from a database, they become configurable, if they are configurable, your project is portable . . . . and you can see where that goes.