Results 1 to 6 of 6

Thread: File name as title

  1. #1
    Join Date
    Aug 2007
    Posts
    22
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default File name as title

    I am looking for a script where it (the php script) reads the name of the file and inserts it into the title.

    For example, if the file name was index.php, then it would look like so:
    <title>Some Text Here <?php "SOME PHP TO PASTE FILENAME"?></title>

    Resulting in Some Text Here Index

    I'm not sure whether i've clarified it enough but hopefully you get what I mean.

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Code:
    <?php echo basename(__FILE__); ?>
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. The Following User Says Thank You to Twey For This Useful Post:

    Valor Studios (02-18-2008)

  4. #3
    Join Date
    Nov 2006
    Location
    Northeast USA
    Posts
    408
    Thanks
    8
    Thanked 30 Times in 28 Posts

    Default

    or
    Code:
    <?php echo $_SERVER['PHP_SELF']; ?>
    -Ben -- THE DYNAMIC DRIVERS
    My Links: My DD Profile||My Youtube Video Tutorials||DD Helping Coders||DD Coders In Training
    I told my client to press F5, the client pressed F, then 5, *facepalm*

  5. The Following User Says Thank You to fileserverdirect For This Useful Post:

    Valor Studios (02-18-2008)

  6. #4
    Join Date
    Aug 2007
    Posts
    22
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    Thanks alot. One question though, is there a way to have it without .php extension?

  7. #5
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Code:
    <?php echo basename(__FILE__, '.php'); ?>
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  8. The Following User Says Thank You to Twey For This Useful Post:

    Valor Studios (02-18-2008)

  9. #6
    Join Date
    Aug 2007
    Posts
    22
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    Thanks alot. Really appreciated.

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
  •