Jump to content

head


user4fun
 Share

Recommended Posts

if i want to have meta tags for every page, but i have a main file that i include for every page called main_hdr.phpthat file has the <head> section that hold my javascipt and the tile.How would i create another head section for the other pages to hold the meta tags. Wht would happen if there is 2 <head> sections?

Link to comment
Share on other sites

You're not allowed to have two <head> elements in any HTML page. The main thing people use PHP for is to create the HTML code, so you can have 2 PHP files writing out 2 HTML <head> elements if you want to, but that's not going to make a valid HTML page. If you want to use something different on another page, either have that page include a different file or check for some variables in the include file that you would set on the other pages.

<?php$piece = 1;include 'menu.php';?>

<?phpif ($piece == 1)  //show some codeelse  //show some other code?>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...