Results 1 to 6 of 6

Thread: Is this possible? (automated browser title)

  1. #1
    Join Date
    Sep 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Is this possible? (automated browser title)

    Hi,
    Something that would be really useful for a new project im working on would be to have automated browser titles using some php code in the <title> tags.
    The only way I can think of doing this is by having the php code read the url im using for navigation, e.g. /windows/atari2600/ and use that data, edit it and have it display as 'Windows > Atari 2600'
    Has this kind of thing been done before? are there any other common ways of doing this? Also are there any tutorials around?
    Thanks!

  2. #2
    Join Date
    Oct 2005
    Posts
    255
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    yse this is possible and there are tutorials out there, perhaps I am reading a book that i bought and it shows how do do that,

    If you are think as the browser title page like

    <title>Welcome to atari2600</title> <<<like that

    and have pages show up like

    <title>Welcome to atari2600 - about</title>

    something like that, sorry... I might be able to post the tutorial,
    but try searching in google
    php titles tutorials

    or something with those keywords and it might help....

    Update!!!!
    It has something to do with
    Code:
    basename($_SERVER['SCRIPT_NAME'])
    Last edited by insanemonkey; 09-25-2007 at 11:58 PM.
    Hey new design new look, goto xudas for personal webdsign help.. (:

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    PHP Code:
    $a explode('/',$_SERVER['PHP_SELF']);
    $a implode(' > ',$a); 
    Probably close. Some reworking is possible.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  4. #4
    Join Date
    Oct 2005
    Posts
    255
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    actually i found the code.....

    In the title tags put this...

    Code:
    <title> Roboto<?php echo "—{$title}"; ?> </title>
    Include this file in the same page.

    Code:
    <?php 
    $title = basename($_SERVER['SCRIPT_NAME'], '.php';
    $title = str_replace('_', ' ', $title);
    $title = ucwords($title);
    ?>
    So there it is... I will tell you what it does to..

    The first line tells you to get the the name and take it and kill the .php.
    The second line takes the name of the title and takes out all the "_" and replaces them with a space.
    The third line takes the title and (ucwords) meaning uppercase words, witch makes them capitalized..

    Hope this works for you!
    Last edited by insanemonkey; 09-27-2007 at 03:47 AM. Reason: Reason for Editing:
    Hey new design new look, goto xudas for personal webdsign help.. (:

  5. #5
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    basename defeats the point. the OP wanted to have the directory displayed as levels in the title.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  6. #6
    Join Date
    Oct 2005
    Posts
    255
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    hahah then I have no freakin clue.... srry
    Hey new design new look, goto xudas for personal webdsign help.. (:

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
  •