ineedhelp73 Posted September 2, 2009 Share Posted September 2, 2009 Definitely a NooB to php programming. This has to do with a client's site where the meta tags are called for specific pages but he has it setup where meta tags are being shown 5 times within the source code. When asked about the issue this is what he sent: "I know about the meta tag problem but I'm not sure how to fix it... I use php with some 'include' commands. Simply, one page pulls another page into itself.... my index.html looks something like this: <head> some stuff including meta info </head> <body> ?php(include'pageheader.html'); ?php(incldue'pagebody.html'); ?php(include'someothercrap.html'); </body> those include files all have their own meta info.... so when php pulls the files in, it includes meta info in the body of the index.html page. I have been looking around to see how people handle this but haven't spent enough time on it.... I need to do a rewrite anyway so I'll probably stop using them then if I can't figure out a work around." If anyone can throw some advice our way it would be super appreciated. I have been looking for a cool place to pick on my php. Much appreciated if able. If I posted this in the wrong section I apologize. Tony Quote Link to comment https://forums.phpfreaks.com/topic/172830-meta-tags-showing-multiple-times-on-pages/ Share on other sites More sharing options...
mmssix Posted September 11, 2009 Share Posted September 11, 2009 Remove all the meta info from the other pages that are included and put the meta info into a separate "include" page. Then simply put that include into the header info on each page. Simple workaround and will not necessitate a full scale recoding. Current: <head> some stuff including meta info </head> <body> ?php(include'pageheader.html'); ?php(incldue'pagebody.html'); ?php(include'someothercrap.html'); </body> Meta.php page: <?php $meta = '<title>MyPage.com</title> <meta http-equiv="Content-Type" content="text/html charset=UTF-8">'; ?> New html page: <?php require('includes/meta.php'); ?> <head> <?php echo $meta; ?> </head> <body> ?php(include'pageheader.html'); ?php(incldue'pagebody.html'); ?php(include'someothercrap.html'); </body> Do that for each page that needs fixing. Again just quick and dirty, not necessarily the right way to fix it. Quote Link to comment https://forums.phpfreaks.com/topic/172830-meta-tags-showing-multiple-times-on-pages/#findComment-916905 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.