Forum Moderators: coopster
I have built a few simple sites with PHP using a template and one variable that is an included file. The include usually has 3-5 functions which fill in the necessary bits of the template.
Basically, the url would look like this:
www.mysite.com/template.php?page=home, for example.
To make sure that things aren't abused, I usually take the variable from the url and check it against a list of valid values which are stored in an array. If it passes you get a page, if not you get a 404.
Now I am building what will likely be a larger site - ie. there could be upwards of 150 pages = 150 values that need to be in that array. The array sits at the top of the template, which for a small site (<30 pages) seems fine. But now things may get to the point that 150+ values sitting there in the main template seems to me to be a bit... rookie.
Is there a simple solution to this? And honestly folks, is there an advantage to me using a database to store all of the data vs. a separate 'include.php' for each page? If so, I would imagine that it's hit the books time for me...
now you can:
1 - easily store hundreds, thousands, or more pages in the database
2 - call them using yourdomain.com/home.htm yourdomain.com/faq.htm etc. etc. etc. - without these files ever really existing :-)