Welcome to Welcome to DNF.com™ - Domain Sales, Domain Forum, Domain Appraisals, Domain Registrars

If you are new to domains and looking to buy, sell and learn about domains then you have come to the right place. DNForum is the largest domain name community on the internet and continues to grow every day. There are over 105,000 domainers on DNForum doing everything from buying domains, selling domains, learning about domains and discussing domains. Take a minute and Register.

Register Today on DNForum IT'S FREE!

Results 1 to 3 of 3
  1. #1
    Platinum Lifetime Member
    SGBoise's Avatar
    Join Date
    Jan 2008
    Location
    USA
    Posts
    41
    DNF$
    275
    Bank
    0
    Total DNF$
    275
    Donate  

    Talking Better code for router/dispatcher

    Hello,
    I am trying to implement router/dispatcher for my script. I looked at how phpcake, codeigniter and zend framework work but they were way to complicated to what I needed.
    I found a tutorial at http://www.phpaddiction.com/tags/axi...-php-part-one/ which is simple to implement.
    I have two types of uri:
    category / id / description.html
    or
    category / subcategory / id / description.html
    Example: /videos/funny/234/funny_monkey_dancing.html

    What I am trying to do is determine category and subcategory, if there is a subcategory, and then the ID.
    The way I am doing it right now doesn't look like the proper way. Is there a better way to do this?

    Here is my code from the tutorial with a few modifications.
    PHP Code:
    //$requestURI = explode('/', $_SERVER['REQUEST_URI']);
    $requestURI explode('/'"tms_routing/videos/funny/234/funny_monkey_dancing.html");
    $subfolder "tms_routing";
    // Remove the subfolder
    if (!$subfolder == "") {
     for(
    $i0;$i sizeof($requestURI);$i++){
      if (
    $requestURI[$i] == $subfolder){
       unset(
    $requestURI[$i]);
       break;
      }
     }
    }
    // Map paths
    if (is_numeric($requestURI[3])) {
     
    $array["category"] = $requestURI[1];
     
    $array["subcategory"] = $requestURI[2];
     
    $array["id"] = $requestURI[3];
    } else {
     
    $array["category"] = $requestURI[1];
     
    $array["id"] =  $requestURI[2];

    Video Script - The ultimate media site script
    AutoVideoScript com - Run your own youtube sharing site

  2. #2
    www.LOL.biz
    Bender's Avatar
    Join Date
    Apr 2004
    Location
    .ro
    Posts
    1,912
    DNF$
    6,066
    Bank
    0
    Total DNF$
    6,066
    Donate  
    nice hat!
    have you considered doing this with mod_rewrite?

  3. #3
    Platinum Lifetime Member
    SGBoise's Avatar
    Join Date
    Jan 2008
    Location
    USA
    Posts
    41
    DNF$
    275
    Bank
    0
    Total DNF$
    275
    Donate  
    Quote Originally Posted by Bender View Post
    nice hat!
    have you considered doing this with mod_rewrite?
    Thanks.

    I am using rewrite to redirect to default.php. I can't use static redirects because the category and subcategory can be changed.
    Video Script - The ultimate media site script
    AutoVideoScript com - Run your own youtube sharing site

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
  •  

Domain name forum recommended by Domaining.com