Changing titles on unique pages

Discussion in 'Programming' started by drhfinegifts, Mar 26, 2006.

  1. #1
    I don't know if this is possible, but it has been bothering me for awhile & would like to know if there is a solution.

    Go to:
    http://www.drhfinegifts.com/index.php/cPath/6772_6933_7036

    and

    http://www.drhfinegifts.com/product_info.php/cPath/6772_6933_7036/products_id/52198

    Notice how the title is the same? I have a sitewide title, but was wondering if it is possible to configure the titles to pull the description from the data table.

    The first number refers to category (women's fragrances).
    The second set refers to 'B' (womens fragrances/b)
    Third is manufacturer (womens fragrances/b/burberry)

    The other URL given is to the actual product.

    Is there a way to make the title unique for each click through to the end result?

    Or am I stuck with a sitewide generic title?
     
    drhfinegifts, Mar 26, 2006 IP
  2. illusion

    illusion Peon

    Messages:
    427
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Yes there is. You can either have a template system or just get the url title before each head.

    <?php
    $r = mysql_fetch_array(mysql_query("SELECT name FROM `products`"));
    
    $title = $r['name'];
    
    ?>
    <html>
    <head>
    <title><?=$title?></title>
    </head>
    <body>
    
    </body>
    <html>
    
    PHP:
    That is the basic skeleton of what you should do
     
    illusion, Mar 26, 2006 IP
  3. drhfinegifts

    drhfinegifts Peon

    Messages:
    368
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Cool. So let me make sure I understand you.

    Instead of this tag in my main_page.tpl.php -

    <title>Discount Perfume | Discount Cologne | Designer Fragrances</title>

    Use the above code instead?

    Or do I need to put it somewhere else in the directory?
     
    drhfinegifts, Mar 26, 2006 IP
  4. illusion

    illusion Peon

    Messages:
    427
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Well I just gave a basic skeleton, but yeah. Just work out the rows and the tables to use in the query and include some extra text but yeah.
     
    illusion, Mar 26, 2006 IP