(Don't believe this is a "best practice" question as I believe there will be a single better choice).
I need to choose a data storage option to store specific site data to allow easy management and re-usability: array; class; DB; Other; but am not sure which one would be adequate.
The data in question is my Services, which is a list of titles and descriptions.
Example of the text:
We provide On and Off site SEO, by careful keyword assignment and placement, blah etc, etc blah etc, etc blah etc, etc blah etc, etc blah etc, etc.
We can provide clean and elegant logos suited to your current company branding... blah etc, etc blah etc, etc blah etc, etc blah etc, etc blah etc, etc blah etc, etc blah etc, etc blah etc, etc blah etc, etc blah etc, etc.
Each title is no more than 5 words, and descriptions are about 70 words/350 chars, and I have about 20 titles and descriptions.
As services can be changed, retracted, and new added, I want control over the data - more than just editing a view/template file where the raw output/HTML is done, because I:
- Require the data to be reusable on different templates
- Want the option to use only a part of each data, eg just the title(s) so a specific array index, or class method, DB table row, etc
I'm reluctant use an array, given the size of the Description text and number of services (20). And it might end up fiddly accessing a specific array value, having to know the exact key (the title), and the key being long.
I could use a multidimensional array, with the top level key being a simple reference, but it seems well overkill for the requirements.
It seems a waste of a class as the data itself is static, and feel I'd be abusing the point of OOP a bit.
I could use a DB, but the site doesn't require a DB for anything else currently, though am happy to implement one if worthwhile for this.
The site is on a framework, loosely on MVC/P, so can implement anything easily.
So, out of the options: array; class; database; (other?) which would be the most suitable for this scenario?
The overhead difference is not an issue, as it'll be marginal enough between all three for my requirements (small site, good hosting etc).
Access to said data will only be on a couple of pages, so having it in memory isn't a large requirement (AFAIK).