SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    ********* Streaker Lister14's Avatar
    Join Date
    Jun 2002
    Location
    C:\Documents and Settings\Desktop\Recycle Bin
    Posts
    677
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    a little help please *link*

    hi there,

    well, i got my page to "recognise" automatically now what page it is...

    PHP Code:
    <?php     $path pathinfo($_SERVER['PHP_SELF']);
        
    $title substr($path["basename"],".php",-4);
        if (
    $title=="index"){
            echo 
    "home";}
        else {echo 
    $title;}
    ?>
    Question:

    i want the above word to link to the corresponding page, i.e. the word "home" to link to the index.php... etc. but i'm going doodle on the backslashes

    thought about somthing along these lines:

    PHP Code:
    <?php     $path pathinfo($_SERVER['PHP_SELF']);
        
    $title substr($path["basename"],".php",-4);

    echo 
    "<a href=\"http://mysite.com/"."$title".".php\">;

        if (
    $title=="index"){
            echo "
    home";}
        else {echo 
    $title;}

    echo "
    </a>";
    ?>

    your help will be appreciated!


    lister
    roy.lu
    C:\DOS... C:\DOS\RUN... RUN\DOS\RUN...!

  2. #2
    My precious!!! astericks's Avatar
    Join Date
    Mar 2002
    Location
    Vancouver, BC
    Posts
    1,971
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
         $path pathinfo($_SERVER['PHP_SELF']);
        
    $title substr($path["basename"],".php",-4);

    echo 
    '<a href="http://mysite.com/' $title '.php">';

        if (
    $title=="index"){
            echo 
    "home";}
        else {echo 
    $title;}

    echo 
    "</a>"
    -asT.

  3. #3
    ********* Streaker Lister14's Avatar
    Join Date
    Jun 2002
    Location
    C:\Documents and Settings\Desktop\Recycle Bin
    Posts
    677
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks sooo much

    am i lucky there is a place like sitepoint
    ... i'd never manage to get all this done without you guys!


    lister
    roy.lu
    C:\DOS... C:\DOS\RUN... RUN\DOS\RUN...!


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
  •