bgbs Posted June 9, 2010 Share Posted June 9, 2010 my header file contains the <head> but I would like to have different meta tags displayed depending on the page being displayed. I know you could insert <head> into each file and be done with it, but that may drive me nuts as the site grows. So I'm trying to see how I can do it differently So far I can do this with php <?php $meta_title="Site title goes here"; $meta_heading="Site heading info goes here"; $meta_desc="Site Description goes here"; $meta_keys="Site, Key, Words, Go, Here"; ?> Then I can call that meta tag by inserting this in the pages <meta name="description" content="<?php echo $meta_desc ?>" /> I also have $page=" unique page name" inserted in each page. I know this php meta script is incomplete, but what can I do to take it to the next level? Do I need to use and if statements, and how would I? Thanks for all your help -Ben Quote Link to comment https://forums.phpfreaks.com/topic/204325-different-php-meta-tags-for-each-page/ Share on other sites More sharing options...
syed Posted June 9, 2010 Share Posted June 9, 2010 It depends where the values for the meta data will be comming from. If all your data is stored in a database then you could construct your meta tags based on the page you are accessing, again it all depends on where the meta data is comming from. Do you have a db table that might be able to construct the meta data? Quote Link to comment https://forums.phpfreaks.com/topic/204325-different-php-meta-tags-for-each-page/#findComment-1070104 Share on other sites More sharing options...
bgbs Posted June 9, 2010 Author Share Posted June 9, 2010 I was thinking in the beginning to store values in the php file for now, and then upgrade to the database later. I'm very new to php and I dont want to go over my head with this php construction. I'm trying to take it one step at a time to master php capabilities. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/204325-different-php-meta-tags-for-each-page/#findComment-1070107 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.