Friday, June 28, 2013

Dynamic Meta Tags (Using PHP)

Dynamic Meta Tags (Using PHP)
Dynamic Meta Tags are used when there is a dynamic element on the page such as a title, deck, and page body. In the example below, the fields, Profile_Name, Profile_Symbol, MetaDesc, and MetaKeywords are used to populate the title with a public company name, and exchange symbol. The description is populated with the first 150 correctors of the deck and the keywords are being populated with the company name and the first 100 characters of the deck. Use the following set of META controls when editing the page source. (Edit to your requirements) $Profile_ID = $company_profile['ID']; $Profile_Name = $company_profile['Name']; $Profile_Symbol = $company_profile['Symbol']; $Profile_Exchange = $company_profile['Exchange']; $Profile_Description = $company_profile['Description']; $MetaDesc=substr($Profile_Description, 0, 150); $MetaKeywords=substr($Profile_Description, 0, 100); <title><?php echo "$Profile_Name"; ?> - <?php echo "$Profile_Symbol"; ?></title> <META NAME="Description" CONTENT="<?php echo "$MetaDesc"; ?>"> <META NAME="Keywords" CONTENT="<?php echo "$Profile_Name"; ?>, <?php echo "$MetaKeywords"; ?>"> <META NAME="author" content="author here"> <META NAME="copyright" content="company here"> <META NAME="language" content="en-us"> <META NAME="rating" content="General"> <META NAME="robots" content="index,follow"> <META NAME="revisit-after" content="7 Days"> <META http-equiv="pragma" content="no-cache">

No comments:

Post a Comment

Other Posts