hello danifriends.
i'm developing my website with php and i want to make dynamic header, so i create i file header.php with logo and menu and the page had all html doctype and and head tag for link with css and js..., i include the header in my page using include(../header/header.php)
, and so i was thinking that i was going to have html doctype 2 time in every pages where i include header and the <head>
so i delete the doctype in header.php and <head>
after that i dont have any php error for include but the space of header when i include it is empty
chrisschristou 0 Posting Whiz
Recommended Answers
Jump to PostThe question is what do you want to load with an include. A menu/navigation I can understand, so that you don't have to add a menu item on every page if you need to, but you say you want also what's in between the head tag in that include. Are …
Jump to Post
header.php
should only contain the code/mark-up that is for your menu, Thus nodoctype
, nohead
, nohtml
and nobody
tags, just only the relvant code/mark-up for you menu. Do you have it like that?
Jump to PostTo give you an example what should only be in
header.php
if you want to include your menu/navigation on all your pages.<nav role="navigation"> <a href="home.php"><img src="img/logo.svg" alt="logo" /></a> <ul> <li><a href="home.php">home</a></li> <li><a href="portfolio.php">portfolio</a></li> <li><a href="services.php">services</a></li> <li><a href="contact.php">contact</a></li> </ul> </nav>
You see? no html, no …
All 12 Replies
Aeonix 71 Posting Whiz
Gideon_1 15 Junior Poster
chrisschristou 0 Posting Whiz
Aeonix 71 Posting Whiz
chrisschristou 0 Posting Whiz
gentlemedia 803 Master Poster
chrisschristou 0 Posting Whiz
gentlemedia 803 Master Poster
chrisschristou 0 Posting Whiz
gentlemedia 803 Master Poster
Mann_Youth 0 Newbie Poster
chrisschristou 0 Posting Whiz
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.