SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    Almeaty Member
    Join Date
    Jul 2000
    Location
    Nowhere
    Posts
    278
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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)

    OR

    should I create new directories for each categorie and place an index.php in each of them? (domain.com/php)


    any advice? tnx

  2. #2
    Serial Publisher silver trophy aspen's Avatar
    Join Date
    Aug 1999
    Location
    East Lansing, MI USA
    Posts
    12,939
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

    Chris

  3. #3
    SitePoint Evangelist
    Join Date
    Jul 2000
    Location
    Warwickshire, England
    Posts
    557
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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 ??

  4. #4
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    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).
    Kevin Yank
    CTO, sitepoint.com
    I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
    Baby’s got back—a hard back, that is: The Ultimate CSS Reference

  5. #5
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •