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 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 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' >"; 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 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 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 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 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
Archived
This topic is now archived and is closed to further replies.