SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    Can we go to a 48 hour day?
    Join Date
    May 2002
    Location
    MI
    Posts
    906
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    changing include file based on url

    I want to change the file included based on part of the url (not querystring)

    my urls will be something like
    mydomain.com/tech/page.php
    or
    mydomain.com/news/page.php

    It is that middle section I need to read out. The reason is to change the nav menu that if you are in the news section the News button is a different graphic (darker color for the menu item you are in).

    Anyone have a suggestion as to how I can get the url into a string I can parse for it? I want to always want to get the first subfolder after the mydomain.com

    Thanks
    mitechie.com
    "Techies just think a little differently
    ...at least that is what they keep telling me."

  2. #2
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why not use Reg Exp to parse out the url (i.e. ignore) all except the text between ...com/ - whatever - /page.php ?

    Provided you only need the 'middle' section and there will only every be 2 slashes this shouldn't be too difficult - if you know Reg Exp that is.

    But I only know the basic's so far I'm afraid 8( But someone will help you though, once they've figured out the Reg Exp that is 8)

  3. #3
    Can we go to a 48 hour day?
    Join Date
    May 2002
    Location
    MI
    Posts
    906
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the big part of my question is how to get the url down from address bar and into a string, once there I think I can work on a regexp
    mitechie.com
    "Techies just think a little differently
    ...at least that is what they keep telling me."

  4. #4
    SitePoint Addict sojomy's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    349
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    $_SERVER['REQUEST_URI'] I think


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
  •