pixelhouse Posted August 13, 2009 Share Posted August 13, 2009 Hi, I've got a site http://www.weddingshoeshop.co.uk/product_detail_wedding.php?pid=120 which I would like to have dynamically set the title tags dependant on a field contained within the page (namely the shoe name). In the code for the page <?=$rs_prod['p_name']?> is used to display the product name. Any advice would be greatly appreciated. Quote Link to comment Share on other sites More sharing options...
DEVILofDARKNESS Posted August 13, 2009 Share Posted August 13, 2009 you only have to do: <html> <head> <title><? $productname ?></title> </head> <body> ... </body> </html> Quote Link to comment Share on other sites More sharing options...
pixelhouse Posted August 13, 2009 Author Share Posted August 13, 2009 Hi, thanks for the suggestion, however I've tried <? $p_name ?> and no joy, http://www.weddingshoeshop.co.uk/product_detail_wedding.php?pid=29 should show "WalkRite DyeRite Wedding Shoes - Product Detail : BLUSH" in as the title, when I use the <title>WalkRite DyeRite Wedding Shoes - Product Detail : <? $p_name ?></title> I assume I'm correct using <? $p_name ?> when the code to call the name in the page itself is <?=$rs_prod['p_name']?> I'm relatively new to php so all help appreciated. Quote Link to comment Share on other sites More sharing options...
Jessica Posted August 13, 2009 Share Posted August 13, 2009 If you print the text one way in the actual page, you'd do the exact same thing in the title. Quote Link to comment Share on other sites More sharing options...
DEVILofDARKNESS Posted August 13, 2009 Share Posted August 13, 2009 SOrry I didn't show it in my code example, but if you want to show the content of a variable (in this case $p_name) you should do: <? echo $p_name; ?> or <? print $p_name; ?> Quote Link to comment Share on other sites More sharing options...
pixelhouse Posted August 13, 2009 Author Share Posted August 13, 2009 Well, I know this should work, but its not working for me. Quote Link to comment Share on other sites More sharing options...
DEVILofDARKNESS Posted August 13, 2009 Share Posted August 13, 2009 Can you give us the whole code.? Quote Link to comment Share on other sites More sharing options...
pixelhouse Posted August 13, 2009 Author Share Posted August 13, 2009 I've attached a zip with the page - many thanks, it has me baffled! [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
DEVILofDARKNESS Posted August 13, 2009 Share Posted August 13, 2009 Okay, it's normal, you can't use $p_name in the title, because it hasn't any value on that moment later in the page it get's his value from rs_prod['p_name'] You should be able to solve this by using this: <title>WalkRite DyeRite Wedding Shoes - Product Detail : <? print $rs_prod['p_name']; ?></title> instead of <title>WalkRite DyeRite Wedding Shoes - Product Detail : <? print $p_name; ?></title> Quote Link to comment Share on other sites More sharing options...
pixelhouse Posted August 13, 2009 Author Share Posted August 13, 2009 Perfect!! Many many thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.