Drkstone Posted August 16, 2006 Share Posted August 16, 2006 Hi, I have a quick question, just wondering if someone can give me a hand with. I am using a header contribution, and wanted to add the product title to the meta tags title. I have figured out how to accomplish this, by some code that I found. $query = tep_db_query("select pd.products_name, pd.products_description from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on (p.products_id=pd.products_id) WHERE p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' AND p.products_status = '1' AND pd.language_id = '" . (int)$languages_id . "'"); $result = ($query); while ($row = mysql_fetch_assoc($result)) { $test = $row["products_name"]; } $metaDescription = $test; $metaTitle ="<title>$test</title>"; echo $metaTitle . "\n"; As this code only displays the product name on product pages, my question is how can I change this code to display another title when not viewing a product page?, for example to display the category title when viewing categories, or just a normal title when viewing the main page? I would be greatful for any help with this. Thanks in advance. Link to comment Share on other sites More sharing options...
Drkstone Posted August 16, 2006 Author Share Posted August 16, 2006 If this is too complicated, can anyone explain to me how I can use the if else statement to place another string for the $metaTitle if the $metaTitle is blank (not a product link). I have tried a few times but keep getting error messages. Noob at php sorry. :blush: Trying to learn. Link to comment Share on other sites More sharing options...
jhsands Posted August 16, 2006 Share Posted August 16, 2006 I saw a contrib that would do that but for the life of me cannot find it now. :S search the contribs and see if you can find it BACKUP your current files before editing. Did I mention to BACKUP your current files, first? "I'm not a hero, I'm a firefighter; it is my job to save lives. I'm a Jesus Christ Firefighter saving souls from the flames!" Installed contribs: Almost XP Buttons *** Attribute Sort *** Auto Thumbnail Change *** Column Product Listing (for SPPC v4.0) *** Contact Us Registered *** Country-State Selector 1.3.3J *** CC# Db Mask 1.3 *** Email Order Clickable Link *** Extra Images *** Linkpoint API CVM *** Loginbox Best *** New Spiders *** New Attrib Mgr v.5.0 w/ New Attrib Include *** Multi Product Update *** MySQL Cron *** Pricing per Category *** Product Listing in Columns v2.2 [later upgraded to CPL(SPPC)] *** Product Sort v1.6 *** Seperate Pricing Per Customer v4.15 *** Simple Down for Maintenance [Gokou] *** Ultimate_SEO_URLs_v2.2.2 *** UPS Worldship Export 1.3 *** Welcome Email username & password Link to comment Share on other sites More sharing options...
Drkstone Posted August 16, 2006 Author Share Posted August 16, 2006 I actually haven't had the best luck getting search engine opt contrbutions to work right for me. I would be happy simply to display a default title when anywhere besides a product page. Could anyone tell me how I can simply use the (if /else) function to display a default title if the above returns blank (ie not a product page)? Would be very greatful. Link to comment Share on other sites More sharing options...
♥toyicebear Posted August 17, 2006 Share Posted August 17, 2006 I actually haven't had the best luck getting search engine opt contrbutions to work right for me. I would be happy simply to display a default title when anywhere besides a product page. Could anyone tell me how I can simply use the (if /else) function to display a default title if the above returns blank (ie not a product page)? Would be very greatful. Click on basic meta tags under for info Basics for osC 2.2 Design - Basics for Design V2.3+ - Seo & Sef Url's - Meta Tags for Your osC Shop - Steps to prevent Fraud... - MS3 and Team News... - SEO, Meta Tags, SEF Urls and osCommerce - Commercial Support Inquiries - OSC 2.3+ How To To see what more i can do for you check out my profile [click here] Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.