SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Dec 2000
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    I'm trying to come up with a simple navigation system similar to that found on sitepoint or ZDNET.

    Example:
    you are here: home > news > articles > latest article

    I'm not sure how to even go about it.

    Would using PHP getenv() be the way to go about it or is there another way?

    What I'm doing at the moment is using getenv() along with dirname() and basename().

    Is this the right way to go about it?

    Thanks,

    Lar

  2. #2
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Give this JavaScript a try:
    http://javascript.internet.com/navig...tory-info.html

    Looks like it might work - thought maybe not as well as you'd like. It's pretty basic.

  3. #3
    midnight coder
    Join Date
    Dec 2000
    Location
    The flat edge of the world
    Posts
    838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That'll probably work, with the getenv, etc.

    Say the file is at www.example.com/news/sport/pingpong/file.php

    You could explode the path to array by the slashes.

    $patharray = explode("/",$path);

    Then echo the array, counting one up each time, so the folder structure could be as deep as you want.

    for ($i=0;$i<count($patharray);$i++)
    {
    echo $textarray[$i] . ">";
    }


    Might need to fine tune the scipt a bit, but that's the basic idea.

  4. #4
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The downside to this is, of course, if you want it all capitalized and using different titles than the exact text in the directory structure...you're out of luck.

    I don't know if PHP has some kind of tool to automatically capitalize the first letter in a word (anyone know about that? I'd love to make use of something like that myself) - but overall you'll need to make sure you name your directories appropriately...IE: to the point, and sensible...IE "javascript" instead of "js"

  5. #5
    midnight coder
    Join Date
    Dec 2000
    Location
    The flat edge of the world
    Posts
    838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could use CSS to make them AllCaps or SmallCaps, not sure if NS supports it though.

  6. #6
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Chris you can use ucfirst($string) to capitalize the first word in a string or ucwords($string) to capitalize the first letter of every word in a string
    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
  •