I want to build up an internet directory for webmaster scripts. So categories like ASP, Perl, PHP etc. Now what I want to know is, would it be elegant to let the server always execute one single file, the index file to fulfill all client requests: parsing the variable for displaying the correct contents (index.php?display=php)
should I create new directories for each categorie and place an index.php in each of them? (domain.com/php)
any advice? tnx
Well you'd want more than 1 file
But you could have a category.php that displays all the contents of a category
your index.php would display all the categories
then a details.php that would display the details of any 1 script
Of course this would also mean that most search engines would only index your front page... but really thats all you want them to index.
If you are using a database (which you seem to be), I would say just use the one file. Otherwise, (if you need to create each page seperately) it is more convenient to have it divided into directories so when maintaining your site you can find files more quickly.
I would propably use a category embedded into the query string, as when visiting websites like hotscripts I usually just type in /PHP. Perhaps an index.php?cat=PHP ??
Yes. What you want to do is divide your scripts based on the functions performed by the scripts -- not the data being accessed by the scripts. So you don't need to create multiple scripts to handle multiple categories (that's what your database is for!), but you should create multiple scripts to present different views of the data (e.g. category list versus details view).
I would have to say at least for me it is easier to create one class for handling everthing and using one page to do it, that way whether they are viewing the categories searching the categories or viewing an item's details, one class does it all and that way you really only have to worry about one page of html I usually only have the opening and closing html tags and then the php class takes it from there.