Keyword in Capital letters in title

Discussion in 'PHP' started by dalv, Mar 2, 2006.

  1. #1
    How can I make a search keyword appear in Capital letters in title?

    <title><?php echo $keywords; ?> something here.</title>[/code]
     
    dalv, Mar 2, 2006 IP
  2. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #2
    To change a string to capitals use
    
    $word  = strtoupper($word); 
    
    PHP:
    To get the referrer details:
    $referer = $_SERVER['HTTP_REFERER'];
    PHP:
    You can then use a regular expression to extract the search terms from the referrer details.
     
    mad4, Mar 2, 2006 IP
  3. Matts

    Matts Berserker

    Messages:
    195
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    108
    #3
    I think you want something like:
    <?php
    $title = "My title IS here";
    $title = strtolower($title);
    $title = ucwords($title);
    ?>
    http://www.php.net/manual/en/function.ucwords.php

    If you do the strtolower() first, it will make sure your title always has only the first letter uc'd.
     
    Matts, Mar 2, 2006 IP
  4. dalv

    dalv Well-Known Member

    Messages:
    130
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    123
    #4
    Thanks guys! That worked!
     
    dalv, Mar 2, 2006 IP