doubledee Posted August 7, 2011 Share Posted August 7, 2011 I need to re-write my HTML Meta-Tag using PHP so I can insert data from my database. What is the best way to do this? Original Code: <meta name="description" content="Postage Meters can save you time and money, and are not as expensive as you might think." > I'm not sure if I can put PHP in between the content quotes? Debbie Quote Link to comment https://forums.phpfreaks.com/topic/244145-best-way-to-write-meta-tag-with-php/ Share on other sites More sharing options...
AyKay47 Posted August 7, 2011 Share Posted August 7, 2011 certainly can Quote Link to comment https://forums.phpfreaks.com/topic/244145-best-way-to-write-meta-tag-with-php/#findComment-1253826 Share on other sites More sharing options...
QuickOldCar Posted August 7, 2011 Share Posted August 7, 2011 <meta name="description" content="<?php echo $string_data;?>" > echo "<meta name='description' content='$string_data' >"; Quote Link to comment https://forums.phpfreaks.com/topic/244145-best-way-to-write-meta-tag-with-php/#findComment-1253827 Share on other sites More sharing options...
doubledee Posted August 7, 2011 Author Share Posted August 7, 2011 I tried this... <?php echo '<meta name="description" content="' . $metaDescription . '">'; echo '<meta name="keywords" content="' . $metaKeywords . '">'; ?> Debbie Quote Link to comment https://forums.phpfreaks.com/topic/244145-best-way-to-write-meta-tag-with-php/#findComment-1253835 Share on other sites More sharing options...
doubledee Posted August 7, 2011 Author Share Posted August 7, 2011 Maybe this looks better... <meta name="description" content="<?php echo $metaDescription; ?>"> <meta name="keywords" content="<?php echo $metaKeywords; ?>"> Debbie Quote Link to comment https://forums.phpfreaks.com/topic/244145-best-way-to-write-meta-tag-with-php/#findComment-1253837 Share on other sites More sharing options...
AyKay47 Posted August 7, 2011 Share Posted August 7, 2011 Maybe this looks better... <meta name="description" content="<?php echo $metaDescription; ?>"> <meta name="keywords" content="<?php echo $metaKeywords; ?>"> Debbie yep Quote Link to comment https://forums.phpfreaks.com/topic/244145-best-way-to-write-meta-tag-with-php/#findComment-1253838 Share on other sites More sharing options...
doubledee Posted August 7, 2011 Author Share Posted August 7, 2011 Thanks all!! Debbie Quote Link to comment https://forums.phpfreaks.com/topic/244145-best-way-to-write-meta-tag-with-php/#findComment-1253842 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.