php title

Discussion in 'PHP' started by snowLee, Mar 26, 2009.

  1. #1
    Can someone please tell me how can I put the article title, for news, in the website title that? I have each title in the news database and I use php to print it.
     
    snowLee, Mar 26, 2009 IP
  2. eamiro

    eamiro Well-Known Member

    Messages:
    274
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    123
    #2
    just use echo:

    <title><?php echo $title; ?></title>
     
    eamiro, Mar 26, 2009 IP
  3. snowLee

    snowLee Member

    Messages:
    55
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #3
    I tried that but I get an undefined index about $title.
     
    snowLee, Mar 26, 2009 IP
  4. steelaz

    steelaz Peon

    Messages:
    47
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You can also use echo shortcut:

    <title><?= $title ?></title>
    PHP:
     
    steelaz, Mar 26, 2009 IP
  5. kusal

    kusal Peon

    Messages:
    91
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #5
    undefined index error occurs because you use an array index without initializing it. its not a error its just a Notice.
     
    kusal, Mar 27, 2009 IP
  6. bartolay13

    bartolay13 Active Member

    Messages:
    735
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    98
    #6
    Dynamically call the values in your database
    then just echo it

    <?php echo $var[dim1][dim2]['column']; etc...?>
     
    bartolay13, Mar 27, 2009 IP
  7. snowLee

    snowLee Member

    Messages:
    55
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #7
    Thank you. You're right. Works now.
     
    snowLee, Mar 27, 2009 IP