Partage
  • Partager sur Facebook
  • Partager sur Twitter

Problem with PHP Include

PHP Include

2 mars 2015 à 17:00:33

Hi Team 

am having a problem of inserting  php include in my menu , whenever i devide my page to put includes i get an error of the display either my menu or page are not showing correct.

Please assist ... below is my page that i want to divide into includes.

----------------- my INDEX.php

<!DOCTYPE  html>
<html>
	<?php include 'includes/head.php' ; ?>
	
	<body class="home">

			<!-- HEADER -->
			<?php include 'includes/header.php' ; ?>
            
            			<!-- ENDS HEADER -->
			
			
			<!-- Menu -->
			<div id="menu">
			
			
			
				<!-- ENDS menu-holder -->
				<div id="menu-holder">
					<!-- wrapper-menu -->
					<div class="wrapper">
						<!-- Navigation -->
						<ul id="nav" class="sf-menu">
							<li class="current-menu-item"><a href="index.php">Home<span class="subheader">Welcome</span></a></li>
							<li><a href="#">Questions & Answers<span class="subheader">check out our updated answers</span></a>
								<ul>
									
									<li><a href="qa.php"><span> QUESTIONS(09-01-2015)</span></a></li>
									<!-- this is where u can remove this and add another content of a dropdown menu 
                                    <li><a href="features-accordion.html"><span> Accordion</span></a></li> -->
									<!--<li><a href="features-toggle.html"><span> Toggle box</span></a></li>
									<li><a href="features-tabs.html"><span> Tabs</span></a></li>
									<li><a href="features-infobox.html"><span> Text box</span></a></li>
									<li><a href="features-monobox.html"><span> Icons</span></a></li> -->
								</ul>
							</li>
							<li><a href="co_policy.php">Communication Policy<span class="subheader">Read our posts</span></a></li>
							<li><a href="#">Information Security Policy <span class="subheader">Read our Information Security</span></a></li>
                            <ul>
									<li><a href="#"><span> Phase 1</span></a></li>
									<li><a href="#"><span> Phase 2 </span></a></li>
									<!-- u can add this drop down menu if there is another item to be added .
                                    <li><a href="gallery-2.html"><span> Two columns </span></a></li> -->
									<!-- u can add this drop down menu if there is another item to be added 
                                    <li><a href="video-gallery.html"><span> Video gallery </span></a></li> -->
</ul>
							<li><a href="#">Organisation Design Process<span class="subheader">About the design Process</span></a>
								<ul>
									<li><a href="odp.php"><span> Phase 1</span></a></li>
									<li><a href="odp2.php"><span> Phase 2 </span></a></li>
                                    <li><a href="final.php"><span> Final Structure</span></a></li>
									<!-- u can add this drop down menu if there is another item to be added .
                                    <li><a href="gallery-2.html"><span> Two columns </span></a></li> -->
									<!-- u can add this drop down menu if there is another item to be added 
                                    <li><a href="video-gallery.html"><span> Video gallery </span></a></li> -->
								</ul>
							</li>

<li><a href="advert.php">Advertisment<span class="subheader">check out our advert</span></a></li>
                            <!--<ul>
                                    <li><a href="cco.php"><span> CCO</span></a></li>
									<li><a href="cio.php"><span> CIO</span></a></li>
                                    <li><a href="hol.php"><span> Head of Legal Affairs</span></a></li>
                                    <li><a href="hor.php"><span> Head of Regulatory &Public Affairs</span></a></li>
                                    <li><a href="hsc.php"><span>Head of Supply Chain & Admin</span></a></li>
                                    <li><a href="rcm.php"><span> Risk & Compliance Manager</span></a></li>
						</ul>
</li>			--><!-- Navigation -->
					</div>
					<!-- wrapper-menu -->
				</div>
				<!-- ENDS menu-holder -->
			</div>
			<!-- ENDS Menu -->
			
			
			

			<!-- Slider -->
			<div id="slider-block"></div>
			<!-- ENDS Slider -->
			
			<!-- MAIN -->
	<div id="main">
				<!-- wrapper-main -->
				<div class="wrapper">
					
					<!-- headline -->
					<div class="clear"></div>
					<!-- ENDS headline -->
					
					<!-- content -->
					<div id="content">
						
							<!-- TABS -->
							<!-- the tabs -->
							<ul class="tabs">
								<li></li>
								<li></li>
								<li></li>
							</ul>
							
							<!-- tab "panes" -->
							<div class="panes">
							
								<!-- Posts -->
								<div>
									<ul class="blocks-thumbs thumbs-rollover">
										<li>
											<a href="#" class="thumb" title="An image"><img src="images/mission.png" alt="Post" /></a>
											<div class="excerpt">
												<a href="#" class="header">Pionniers</a>
												Pour demeurer au sommet, nous cherchons sans relâche des solutions innovantes, et nous augmentons constamment de connaissances de base avec une passion absolue pour l’excellence.
										  </div>
											
										</li>
										<li>
											<a href="#" class="thumb" title="An image"><img src="images/vision.png" alt="Post" /></a>
											<div class="excerpt">
												<a href="#" class="header">Professionels</a>
												Dans tout ce que nous faisons, nous nous focalisons sur l’orientation et l’objectif du client. En tout temps, nous effectuons nos tâches avec compétence, diligence et éthique.
										  </div>
											</li>
										<li>
											<a href="#" class="thumb" title="An image"><img src="images/value.png" alt="Post" /></a>
											<div class="excerpt">
												<a href="#" class="header">Personnels</a>
												A l’interne, nous sommes conscients que nous sommes une société de personnes et ces personnes sont la société. Nous apprécions que chacun est un membre valeureux, intrinsèque de l'organisation, indépendamment de son genre, de sa race ou de sa position. Notre relation avec nos clients nous aidera à les satisfaire avec une chaleur et une réelle 
volonté d'anticiper et de répondre à leurs besoins.
										  </div>
											
										</li>
									</ul>
								</div>
								<!-- ENDS posts -->
								
								<!-- Information  -->
								<div>
									<div class="plain-text">
										<h6>Pellentesque habitant morbi tristique senectus et netus et malesuada.</h6> 
										<p>Fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus. </p>
										<p>Fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus.Fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper <a href="single.html">This is a link</a>. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus. </p>
										</div>
								</div>
								<!-- ENDS Information -->

								<!-- Posts -->
								<div>
									<ul class="blocks-thumbs thumbs-rollover">
										<li>
											<a href="single.html" class="thumb" title="An image"><img src="img/dummies/282x150.gif" alt="Post" /></a>
											<div class="excerpt">
												<a href="single.html" class="header">Lorem ipsum dolor</a>
												Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra.
											</div>
											</li>
										<li>
											<a href="single.html" class="thumb" title="An image"><img src="img/dummies/282x150.gif" alt="Post" /></a>
											<div class="excerpt">
												<a href="single.html" class="header">Lorem ipsum dolor</a>
												Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra.
											</div>
											</li>
										<li>
											<a href="single.html" class="thumb" title="An image"><img src="img/dummies/282x150.gif" alt="Post" /></a>
											<div class="excerpt">
												<a href="single.html" class="header">Lorem ipsum dolor</a>
												Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra.
											</div>
											
										</li>
									</ul>
								</div>
								<!-- ENDS posts -->
								
								
							</div>
							<!-- ENDS TABS -->
		
		
		
					</div>
					<!-- ENDS content -->
				</div>
				<!-- ENDS wrapper-main -->
			</div>
			<!-- ENDS MAIN -->
			
			<!-- Twitter --><!-- ENDS Twitter -->

			
			<!-- FOOTER -->
			<?php include 'includes/footer.php' ; ?>
</html>
-------------------------- head.php
<head>
		<meta charset="utf-8">
		<title>My PHP Intranet</title>
		
		<!-- CSS -->
		<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" />
		<link rel="stylesheet" href="css/social-icons.css" type="text/css" media="screen" />
		<!--[if IE 8]>
			<link rel="stylesheet" type="text/css" media="screen" href="css/ie8-hacks.css" />
		<![endif]-->
		<!-- ENDS CSS -->	
		
		<!-- GOOGLE FONTS 
		<link href='http://fonts.googleapis.com/css?family=Ubuntu' rel='stylesheet' type='text/css'>-->
		
		<!-- JS -->
		<script type="text/javascript" src="js/jquery-1.5.1.min.js"></script>
		<script type="text/javascript" src="js/jquery-ui-1.8.13.custom.min.js"></script>
		<script type="text/javascript" src="js/easing.js"></script>
		<script type="text/javascript" src="js/jquery.scrollTo-1.4.2-min.js"></script>
		<script type="text/javascript" src="js/jquery.cycle.all.js"></script>
		<script type="text/javascript" src="js/custom.js"></script>
		
		<!-- Isotope -->
		<script src="js/jquery.isotope.min.js"></script>
		
		<!--[if IE]>
			<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
		<![endif]-->
		
		<!--[if IE 6]>
			<script type="text/javascript" src="js/DD_belatedPNG.js"></script>
			<script>
	      		/* EXAMPLE */
	      		//DD_belatedPNG.fix('*');
	    	</script>
		<![endif]-->
		<!-- ENDS JS -->
		
		
		<!-- Nivo slider -->
		<link rel="stylesheet" href="css/nivo-slider.css" type="text/css" media="screen" />
		<script src="js/nivo-slider/jquery.nivo.slider.js" type="text/javascript"></script>
		<!-- ENDS Nivo slider -->
		
		<!-- tabs -->
		<link rel="stylesheet" href="css/tabs.css" type="text/css" media="screen" />
		<script type="text/javascript" src="js/tabs.js"></script>
  		<!-- ENDS tabs -->
  		
  		<!-- prettyPhoto -->
		<script type="text/javascript" src="js/prettyPhoto/js/jquery.prettyPhoto.js"></script>
		<link rel="stylesheet" href="js/prettyPhoto/css/prettyPhoto.css" type="text/css" media="screen" />
		<!-- ENDS prettyPhoto -->
		
		<!-- superfish -->
		<link rel="stylesheet" media="screen" href="css/superfish.css" /> 
		<link rel="stylesheet" media="screen" href="css/superfish-left.css" /> 
		<script type="text/javascript" src="js/superfish-1.4.8/js/hoverIntent.js"></script>
		<script type="text/javascript" src="js/superfish-1.4.8/js/superfish.js"></script>
		<script type="text/javascript" src="js/superfish-1.4.8/js/supersubs.js"></script>
		<!-- ENDS superfish -->
		
		<!-- poshytip -->
		<link rel="stylesheet" href="js/poshytip-1.0/src/tip-twitter/tip-twitter.css" type="text/css" />
		<link rel="stylesheet" href="js/poshytip-1.0/src/tip-yellowsimple/tip-yellowsimple.css" type="text/css" />
		<script type="text/javascript" src="js/poshytip-1.0/src/jquery.poshytip.min.js"></script>
		<!-- ENDS poshytip -->
		
		<!-- Tweet -->
		<link rel="stylesheet" href="css/jquery.tweet.css" media="all"  type="text/css"/> 
		<script src="js/tweet/jquery.tweet.js" type="text/javascript"></script> 
		<!-- ENDS Tweet -->
		
		<!-- Fancybox -->
		<link rel="stylesheet" href="js/jquery.fancybox-1.3.4/fancybox/jquery.fancybox-1.3.4.css" type="text/css" media="screen" />
	<script type="text/javascript" src="js/jquery.fancybox-1.3.4/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
		<!-- ENDS Fancybox -->
		
		

    <style type="text/css">
    body {
	background-color: #FFFFFF;
}
    #apDiv1 {
	position:absolute;
	width:200px;
	height:24px;
	z-index:1;
	left: 831px;
	top: 86px;
}
    #apDiv2 {
	position:absolute;
	width:200px;
	height:28px;
	z-index:2;
	left: 1010px;
	top: 86px;
}
    </style>
	</head>
---------------------------------
My Header.php

 -------

<div id="header">
				<!-- wrapper-header -->
			  <div class="wrapper">
					<a href="index.html"><img id="logo" src="img/logo2.png" alt="Nova" /></a>
					<!-- search --><!-- ENDS search -->
				</div>
			  <div id="apDiv2"><div style="color:#3B4990;font-size:12px;font-family:Arial;font-weight:normal;font-style:normal;text-decoration:none" id="basicclock"></div>
<script type="text/javascript">
function clock() 
{
   var digital = new Date();
   var hours = digital.getHours();
   var minutes = digital.getMinutes();
   var seconds = digital.getSeconds();
   if (minutes <= 9) minutes = "0" + minutes;
   if (seconds <= 9) seconds = "0" + seconds;
   dispTime = hours + ":" + minutes + ":" + seconds;

   var basicclock = document.getElementById('basicclock');
   basicclock.innerHTML = dispTime;
   setTimeout("clock()", 1000);
}
clock();
</script>
</div>
				<div id="apDiv1"><div style="color:#3B4990;font-size:12px;font-family:Arial;font-weight:normal;font-style:normal;text-decoration:none" id="basicdate"></div>
<script type="text/javascript">
   var now = new Date();
   var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
   var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
   var date = ((now.getDate() < 10) ? "0" : "") + now.getDate();
   var year = (now.getYear() < 1000) ? now.getYear() + 1900 : now.getYear();
   today = days[now.getDay()] + ", " + months[now.getMonth()] + " " + date + ", " + year;
   var basicdate = document.getElementById('basicdate');
   basicdate.innerHTML = today;
</script>

</div>
				<!-- ENDS wrapper-header -->					
			</div>

----------------------------

My Footer.php

------

<div id="footer">
				<!-- wrapper-footer -->
				<div class="wrapper">
					<!-- footer-cols -->
					<ul id="footer-cols">
					  <li class="col">
					
                    <div class="hline-w"></div>
<h6>Other Links:</h6>
                    <div class="hline-w"></div>
                     <ul>
                      <li>Home </li>
                      <li>Promotions</li>
                      <li><a href="contact.php">Contact</a></li>
                    </ul>
                    <p>&nbsp;</p>
					  </li>
						
						<li class="col">
							<h6>About the Intranet</h6>
							<p>the purpose of this Intranet <br/></p>
                            <p>is to assist EWB Employees to <br/></p>
                            <p>Access Standard document or information  <br/></p>
                            <p>News and update about Internal Procedures <br/></p>
						<li class="col">
							<h6>Address</h6>
                    <div class="hline-w"></div>
		 			<p>281 AV, Boulevard de l'uprona<br>
	 			    PO Box: 431 , Bujumbura Burundi</p>
	 			  <p>Telephone: +257 22 24 31 31<br/>Fax:+257 22 24 35 35</p>
		 			
		 			<p><br/>
	 			  </p>
						</li>
						
					</ul>
					<!-- ENDS footer-cols -->
				</div>
				<!-- ENDS wrapper-footer -->
			</div>
			<!-- ENDS FOOTER -->
		
		
			<!-- Bottom -->
			<div id="bottom">
				<!-- wrapper-bottom -->
				<div class="wrapper">
					<div id="bottom-text">2015 EWB all rights reserved. <a href="http://www.econet.bi"> Design and supported by EWB IS team</a> </div>
					<!-- Social -->
					<ul class="social ">
						<li><a href="http://www.facebook.com" class="poshytip  facebook" title="Follow us on Facebook"></a></li>
						<li><a href="http://www.twitter.com" class="poshytip twitter" title="Follow our tweets"></a></li>
						
					</ul>
					<!-- ENDS Social -->
					<div id="to-top" class="poshytip" title="To top"></div>
				</div>
				<!-- ENDS wrapper-bottom -->
			</div>
			<!-- ENDS Bottom -->
	
	</body>

Please assist me and tell me where i did go wrong .




  • Partager sur Facebook
  • Partager sur Twitter
2 mars 2015 à 17:24:08

bonjour,

i have a remarque , you put 

  <?php include 'includes/header.php' ; ?>

after body , and the header.php contain the tag <header> , i think that it is wrong to make <header> after <body> !!!

  • Partager sur Facebook
  • Partager sur Twitter
Le succès n’est pas la clé du bonheur. Le bonheur est la clé du succès. Si vous aimez ce que vous faites, vous réussirez. Albert Schweitzer
2 mars 2015 à 17:29:39

Maryamma : you're confusing <header/> which is a new HTML5 tag made for the header part of a web page's design, with the <head/> tag with is indeed meant to be outside of the body. ft85's include order is perfectly fine.

ft85 : Ooops, you created your topic in the french mirror of the website. :(
I hope the topic can be moved to its proper place.

As for your problem, what is not correct about what you see ? Your description is way too vague for us to have a clue on what's going on.

  • Partager sur Facebook
  • Partager sur Twitter
6 mars 2015 à 19:27:49

Thanks Darth Killer 

first i would like to know how to move this topic to a proper place if possible.

second my problem is when i call for an include using the include php , am getting a menu which is not well designed and also i dont see the php tags appearing so that means the way i have place the include is not well working as it is supposed too especially in the design view.

  • Partager sur Facebook
  • Partager sur Twitter
6 mars 2015 à 21:04:00

ft85 a écrit:

I would like to know how to move this topic to a proper place if possible.

You can't. A moderator is needed.

ft85 a écrit:

My problem is when i call for an include using the include php , am getting a menu which is not well designed and also i dont see the php tags appearing so that means the way i have place the include is not well working as it is supposed too especially in the design view.


Well, it does work as intended, considering your header.php file has no PHP code means including it is the same as echoing its contents. Now, what you do need to check is either the output HTML code is as intended or not. From your web browser, ask for the page's source code to see the HTML code recieved after PHP finished its work.

-
Edité par Darth Killer 6 mars 2015 à 21:04:25

  • Partager sur Facebook
  • Partager sur Twitter
9 mars 2015 à 2:44:52

<?php

include('yourPageHere.php');
You can also use include_once() instead of include() for PHP controler pages included to avoid some problems
  • Partager sur Facebook
  • Partager sur Twitter