Is it good practice to add a php include of the head section in my pages?

后端 未结 4 969
我在风中等你
我在风中等你 2021-02-06 11:25

I am creating my portfolio site and I am wanting to include the head section as a php include on my page. Reason being is because the site will have a fair few pages and I will

4条回答
  •  长发绾君心
    2021-02-06 12:05

    Yep, it's quite standard. But instead of writing:

    
        
    
    

    you should put the tags inside head.php. I say it's better because what's inside head.php has no sense without the head tags, so they are kinda linked together. It's good practice to join things so linked into a single file without having to repeat open and close head tags for each page.

    Actually, it's even good practice (and commonly used) to have header.php, body.php and footer.php files that has respectively:

    header.php

    
    
    ...
    
    
    

    body.php

    ...
    

    footer.php

    
    
    

提交回复
热议问题