{"id":2689,"date":"2015-05-26T07:26:04","date_gmt":"2015-05-26T07:26:04","guid":{"rendered":"http:\/\/www.vishmax.com\/en\/?p=2689"},"modified":"2015-05-26T07:26:04","modified_gmt":"2015-05-26T07:26:04","slug":"how-to-include-php-headers-on-html-site","status":"publish","type":"post","link":"https:\/\/www.vishmax.com\/en\/labs\/how-to-include-php-headers-on-html-site\/","title":{"rendered":"How to include php headers on html site"},"content":{"rendered":"<p>PHP is a powerful language for web development, it have many in built functions. Here is a post which explains how to include php headers on html site. Including the header dynamically is a good idea because with single file edit you can make changes on entire website. For example think there are hundreds of pages in a website and want to edit the menu, what will do? is it easy to edit all pages one by one, so such situation you can include a dynamic header on the site and the common header will call on each page, so if you want to edit the menu just edit the header template and it will reflect changes on entire website. We can understand it more clearly with below example.<\/p>\n<h2>Creating header.php<\/h2>\n<p>First you need to create a PHP page called <span class=\"highlight\">header.php<\/span> an add below html codes to it and save in root folder (You can save it wherever you want, in this example we assume its is saved on root folder of server.)<\/p>\n<pre lang=\"php\">\r\n<nav role=\"navigation\">\r\n    <a href=\"index\"><img decoding=\"async\" src=\"images\/logo.png\" alt=\"logo\" \/><\/a>\r\n    <ul>\r\n        <li><a href=\"home.php\">Home<\/a><\/li>\r\n        <li><a href=\"about_us.php\">About Us<\/a><\/li>\r\n        <li><a href=\"services.php\">Services<\/a><\/li>\r\n        <li><a href=\"contact_us.php\">Contact<\/a><\/li>\r\n    <\/ul>\r\n<\/nav>\r\n<\/pre>\n<h2>PHP including method<\/h2>\n<p>To include you can use the &#8216;include&#8217; function of PHP, it looks like below.<\/p>\n<pre lang=\"php\">\r\n\t<?php include 'header.php';?>\r\n<\/pre>\n<p>Below is the full html code which looks like after including the header template.<\/p>\n<pre lang=\"php\">\r\n\t<!doctype html>\r\n\t<html>\r\n\t\t<head>\r\n\t\t<!-- Add metadata and styles here -->\r\n\t\t<\/head>\r\n\t\t<body>\r\n\t\t\t<header>\r\n\t\t\t\t<?php include 'header.php'; \/\/ assuming its is in same folder, otherwise add exact path?>\r\n\t\t\t<\/header>\r\n\t\t\t<main role=\"main\">\r\n\t\t\t\t<!-- Your main content -->\r\n\t\t\t<\/main>\r\n\t\t\t<footer>\r\n\t\t\t\t<!-- Your footer content -->\r\n\t\t\t<\/footer>\r\n\t\t<\/body>\r\n\t<\/html>\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>PHP is a powerful language for web development, it have many in built functions. Here is a post which explains how to include php headers on html site. Including the header dynamically is a good idea because with single file edit you can make changes on entire website. For example think there are hundreds of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[44],"tags":[72,108,48],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.2.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to include php headers on html site - Vishmax.com<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/www.vishmax.com\/en\/labs\/how-to-include-php-headers-on-html-site\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to include php headers on html site - Vishmax.com\" \/>\n<meta property=\"og:description\" content=\"PHP is a powerful language for web development, it have many in built functions. Here is a post which explains how to include php headers on html site. Including the header dynamically is a good idea because with single file edit you can make changes on entire website. For example think there are hundreds of [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"http:\/\/www.vishmax.com\/en\/labs\/how-to-include-php-headers-on-html-site\/\" \/>\n<meta property=\"og:site_name\" content=\"Vishmax.com\" \/>\n<meta property=\"article:published_time\" content=\"2015-05-26T07:26:04+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"http:\/\/www.vishmax.com\/en\/labs\/how-to-include-php-headers-on-html-site\/#article\",\"isPartOf\":{\"@id\":\"http:\/\/www.vishmax.com\/en\/labs\/how-to-include-php-headers-on-html-site\/\"},\"author\":{\"name\":\"admin\",\"@id\":\"http:\/\/www.vishmax.com\/en\/#\/schema\/person\/785fa94b56eb17ae7706d30777d6ab93\"},\"headline\":\"How to include php headers on html site\",\"datePublished\":\"2015-05-26T07:26:04+00:00\",\"dateModified\":\"2015-05-26T07:26:04+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/www.vishmax.com\/en\/labs\/how-to-include-php-headers-on-html-site\/\"},\"wordCount\":214,\"publisher\":{\"@id\":\"http:\/\/www.vishmax.com\/en\/#organization\"},\"keywords\":[\"Code Library\",\"HTML\",\"PHP\"],\"articleSection\":[\"Labs\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/www.vishmax.com\/en\/labs\/how-to-include-php-headers-on-html-site\/\",\"url\":\"http:\/\/www.vishmax.com\/en\/labs\/how-to-include-php-headers-on-html-site\/\",\"name\":\"How to include php headers on html site - Vishmax.com\",\"isPartOf\":{\"@id\":\"http:\/\/www.vishmax.com\/en\/#website\"},\"datePublished\":\"2015-05-26T07:26:04+00:00\",\"dateModified\":\"2015-05-26T07:26:04+00:00\",\"breadcrumb\":{\"@id\":\"http:\/\/www.vishmax.com\/en\/labs\/how-to-include-php-headers-on-html-site\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/www.vishmax.com\/en\/labs\/how-to-include-php-headers-on-html-site\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/www.vishmax.com\/en\/labs\/how-to-include-php-headers-on-html-site\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/www.vishmax.com\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to include php headers on html site\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/www.vishmax.com\/en\/#website\",\"url\":\"http:\/\/www.vishmax.com\/en\/\",\"name\":\"Vishmax.com\",\"description\":\"Software Company in Calicut for Web Design and eCommerce\",\"publisher\":{\"@id\":\"http:\/\/www.vishmax.com\/en\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/www.vishmax.com\/en\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"http:\/\/www.vishmax.com\/en\/#organization\",\"name\":\"Vishmax.com\",\"url\":\"http:\/\/www.vishmax.com\/en\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/www.vishmax.com\/en\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.vishmax.com\/en\/wp-content\/uploads\/2023\/03\/logo-vishmax.png\",\"contentUrl\":\"https:\/\/www.vishmax.com\/en\/wp-content\/uploads\/2023\/03\/logo-vishmax.png\",\"width\":150,\"height\":50,\"caption\":\"Vishmax.com\"},\"image\":{\"@id\":\"http:\/\/www.vishmax.com\/en\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"http:\/\/www.vishmax.com\/en\/#\/schema\/person\/785fa94b56eb17ae7706d30777d6ab93\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/www.vishmax.com\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/e218268870406c917d20b442936d9e68?s=96&d=monsterid&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/e218268870406c917d20b442936d9e68?s=96&d=monsterid&r=g\",\"caption\":\"admin\"},\"url\":\"https:\/\/www.vishmax.com\/en\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to include php headers on html site - Vishmax.com","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/www.vishmax.com\/en\/labs\/how-to-include-php-headers-on-html-site\/","og_locale":"en_US","og_type":"article","og_title":"How to include php headers on html site - Vishmax.com","og_description":"PHP is a powerful language for web development, it have many in built functions. Here is a post which explains how to include php headers on html site. Including the header dynamically is a good idea because with single file edit you can make changes on entire website. For example think there are hundreds of [&hellip;]","og_url":"http:\/\/www.vishmax.com\/en\/labs\/how-to-include-php-headers-on-html-site\/","og_site_name":"Vishmax.com","article_published_time":"2015-05-26T07:26:04+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/www.vishmax.com\/en\/labs\/how-to-include-php-headers-on-html-site\/#article","isPartOf":{"@id":"http:\/\/www.vishmax.com\/en\/labs\/how-to-include-php-headers-on-html-site\/"},"author":{"name":"admin","@id":"http:\/\/www.vishmax.com\/en\/#\/schema\/person\/785fa94b56eb17ae7706d30777d6ab93"},"headline":"How to include php headers on html site","datePublished":"2015-05-26T07:26:04+00:00","dateModified":"2015-05-26T07:26:04+00:00","mainEntityOfPage":{"@id":"http:\/\/www.vishmax.com\/en\/labs\/how-to-include-php-headers-on-html-site\/"},"wordCount":214,"publisher":{"@id":"http:\/\/www.vishmax.com\/en\/#organization"},"keywords":["Code Library","HTML","PHP"],"articleSection":["Labs"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"http:\/\/www.vishmax.com\/en\/labs\/how-to-include-php-headers-on-html-site\/","url":"http:\/\/www.vishmax.com\/en\/labs\/how-to-include-php-headers-on-html-site\/","name":"How to include php headers on html site - Vishmax.com","isPartOf":{"@id":"http:\/\/www.vishmax.com\/en\/#website"},"datePublished":"2015-05-26T07:26:04+00:00","dateModified":"2015-05-26T07:26:04+00:00","breadcrumb":{"@id":"http:\/\/www.vishmax.com\/en\/labs\/how-to-include-php-headers-on-html-site\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/www.vishmax.com\/en\/labs\/how-to-include-php-headers-on-html-site\/"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/www.vishmax.com\/en\/labs\/how-to-include-php-headers-on-html-site\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/www.vishmax.com\/en\/"},{"@type":"ListItem","position":2,"name":"How to include php headers on html site"}]},{"@type":"WebSite","@id":"http:\/\/www.vishmax.com\/en\/#website","url":"http:\/\/www.vishmax.com\/en\/","name":"Vishmax.com","description":"Software Company in Calicut for Web Design and eCommerce","publisher":{"@id":"http:\/\/www.vishmax.com\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/www.vishmax.com\/en\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"http:\/\/www.vishmax.com\/en\/#organization","name":"Vishmax.com","url":"http:\/\/www.vishmax.com\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/www.vishmax.com\/en\/#\/schema\/logo\/image\/","url":"https:\/\/www.vishmax.com\/en\/wp-content\/uploads\/2023\/03\/logo-vishmax.png","contentUrl":"https:\/\/www.vishmax.com\/en\/wp-content\/uploads\/2023\/03\/logo-vishmax.png","width":150,"height":50,"caption":"Vishmax.com"},"image":{"@id":"http:\/\/www.vishmax.com\/en\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"http:\/\/www.vishmax.com\/en\/#\/schema\/person\/785fa94b56eb17ae7706d30777d6ab93","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/www.vishmax.com\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/e218268870406c917d20b442936d9e68?s=96&d=monsterid&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e218268870406c917d20b442936d9e68?s=96&d=monsterid&r=g","caption":"admin"},"url":"https:\/\/www.vishmax.com\/en\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.vishmax.com\/en\/wp-json\/wp\/v2\/posts\/2689"}],"collection":[{"href":"https:\/\/www.vishmax.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.vishmax.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.vishmax.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vishmax.com\/en\/wp-json\/wp\/v2\/comments?post=2689"}],"version-history":[{"count":0,"href":"https:\/\/www.vishmax.com\/en\/wp-json\/wp\/v2\/posts\/2689\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.vishmax.com\/en\/wp-json\/wp\/v2\/media?parent=2689"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vishmax.com\/en\/wp-json\/wp\/v2\/categories?post=2689"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vishmax.com\/en\/wp-json\/wp\/v2\/tags?post=2689"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}