Jump to content

Trying to load an include file within html/div page


Go to solution Solved by enemeth,

Recommended Posts

Hello All,

 

I have been going crazy trying to figure this out, I hope someone can help me out :)

 

I have header and footer.php files that on all my pages I get them to load with include,

 

but for some strange reason, this certain page it will not load I did some research and apparently theres problems with div and php, does anyone know how to make this work?

 

Thank you in advance,

Elaine :)

test.txt

Edited by enemeth

Is this page in the same folder as the ones that load it correctly? If not, you would need to change the includes to match the path to the header and footer files.

 

Slightly off topic, is your closing body tag included in footer.php as it is not in that page?

What are you seeing a blank white page?

 

This usually indicates PHP encounted an error and has stopped the script from running. To so why you need to either enable error reporting or check your servers error logs. Try changing the first line to

<?php 
/* enable error reporting on this page */
ini_set('display_errors', true);
error_reporting(E_ALL);

include'header.php';
?>

if there is a problem errors should be shown on screen.

You forgot to add a semicolon at the end of each php line, wrap them as well

<?php include'header.php'?>

to

<?php include('header.php');?>

and

<?php include'footer.php'?>

to

<?php include('footer.php');?>
Edited by QuickOldCar

tried all that, and nothing, the error reporting code didn't give any errors, and the semi colon did no change all the rest of my include files in my other pages do not have them and they work just fine.  which is funny, but they do....

nothing happens at all, the header just doesn't appear, it is blank

Ok, well what I suggested was not actually required those instances, worth a shot.

 

So what is different from those pages from the other pages that do work?

 

Is the page a .php file or is it a .html,.htm or other file extension?

 

Mind pasting header.php with footer.php and also tell us the name of the file and it's exact location.

 

You can show us code directly using the forums code tags by clicking <>

<table border="0" width="970" bgcolor="ffffff">   
  <tr>   
    <td width="100%" height="31"><font face="Bookman Old Style" size="2"><center><a href="index.php">Home</a> / <a  href="links.php">Link to Us</a> / <a  href="emailer.php">Newsletter</a> / <a href="terms.php">Terms & Conditions</a> / <a  href="privacy.php">Privacy </a>/<a href="contactus.php"> Contact Us</a> <br><font size="1">Copyrights ©  2014 Loads Of Ads - All Rights Reserved</font></center></font></td>   
 </tr>    
</table>
    </td>
  </tr>
</table>   
</center>   <script src="ratingfiles/ratings.js" type="text/javascript"></script>
</body>   
</html>


		

    <style> 
        .captionOrange, .captionBlack
        {
            color: #fff;
            font-size: 20px;
            line-height: 30px;
            text-align: center;
            border-radius: 4px;
        }
        .captionOrange
        {
            background: #EB5100;
            background-color: rgba(235, 81, 0, 0.6);
        }
        .captionBlack
        {
        	font-size:16px;
            background: #000;
            background-color: rgba(0, 0, 0, 0.4);
        }
        a.captionOrange, A.captionOrange:active, A.captionOrange:visited
        {
        	color: #ffffff;
        	text-decoration: none;
        }
        a.captionOrange:hover
        {
            color: #eb5100;
            text-decoration: underline;
            background-color: #eeeeee;
            background-color: rgba(238, 238, 238, 0.7);
        }
        .bricon
        {
            background: url(img/browser-icons.png);
        }
    </style>
        <!-- ThumbnailNavigator Skin End -->
        
        <!-- Bullet Navigator Skin Begin -->
        <!-- jssor slider bullet navigator skin 01 -->
        <style>
            /*
            .jssorb01 div           (normal)
            .jssorb01 div:hover     (normal mouseover)
            .jssorb01 .av           (active)
            .jssorb01 .av:hover     (active mouseover)
            .jssorb01 .dn           (mousedown)
            */
            .jssorb01 div, .jssorb01 div:hover, .jssorb01 .av
            {
                filter: alpha(opacity=70);
                opacity: .7;
                overflow:hidden;
                cursor: pointer;
                border: #000 1px solid;
            }
            .jssorb01 div { background-color: gray; }
            .jssorb01 div:hover, .jssorb01 .av:hover { background-color: #d3d3d3; }
            .jssorb01 .av { background-color: #fff; }
            .jssorb01 .dn, .jssorb01 .dn:hover { background-color: #555555; }
        </style>
        <!-- Bullet Navigator Skin End -->
        
        <!-- Arrow Navigator Skin Begin -->
        <style>
            /* jssor slider arrow navigator skin 05 css */
            /*
            .jssora05l              (normal)
            .jssora05r              (normal)
            .jssora05l:hover        (normal mouseover)
            .jssora05r:hover        (normal mouseover)
            .jssora05ldn            (mousedown)
            .jssora05rdn            (mousedown)
            */
            .jssora05l, .jssora05r, .jssora05ldn, .jssora05rdn
            {
            	position: absolute;
            	cursor: pointer;
            	display: block;
                background: url(/img/a17.png) no-repeat;
                overflow:hidden;
            }
            .jssora05l { background-position: -10px -40px; }
            .jssora05r { background-position: -70px -40px; }
            .jssora05l:hover { background-position: -130px -40px; }
            .jssora05r:hover { background-position: -190px -40px; }
            .jssora05ldn { background-position: -250px -40px; }
            .jssora05rdn { background-position: -310px -40px; }
        </style>
<link href="ratingfiles/ratings.css" rel="stylesheet" type="text/css" />

<body style="margin:0;"> 
<center> 
<table border="1" width="100%" bgcolor="ffffff">
  <tr>
    <td width="100%"><center>
    <table border="0" width="968" bgcolor="ffffff">
  <tr>
    <td width="500"><a href="index.php"><img border="0" src="images/LoadsOfAdslogo.jpg" title="Loads Of Ads" width="498" height="90"></a></td>
    <td width="454" align="right"><form action="sphider/search.php" method="get">

<input type="text" name="query" id="query" size="40" value="" action="sphider/include/js_suggest/suggest.php" columns="2"   autocomplete="off" delay="1500">	
<input type="submit" value="Search This Site">   
<input type="hidden" name="search" value="1">   
</a></form></td></tr></table> <hr width="968">  
<table border="0" width="970"> 
  <tr> 
    <td width="100%"><link href="css/topmenu.css" rel="stylesheet" type="text/css" />
<script type='text/javascript' src='js/topmenu.js'></script><ul id="qm0" class="qmmc">
	<li><a href="javascript:void(0);"></a> </li> 
	<li><a href="javascript:void(0);"></a> </li>
	<li><a href="javascript:void(0);"></a> </li>
	<li><a href="index.php" title="Home Page">Home</a></li>   
	<li><a href="forum/index.php" title="Forum">Forum</a></li>  
	<li><a href="links.php" title="Links">Link To Us</a></li>   
	<li><a href="aboutus.php" title="About Us">About Us</a></li>   
	<li><a href="contactus.php" title="Contact Us">Contact Us</a></li>
	<li><a class="qmparent" href="javascript:void(0);">Categories <img src="images/arrow_6.gif"></a>

		<ul>
		<li><a class="qmparent" href="javascript:void(0);">Apparel  <img src="images/arrow_4.gif"></a>

			<ul>
			<li><a href="appkids.php">Kids</a></li>
			<li><a href="appmens.php">Men</a></li>
			<li><a href="appwomens.php">Women</a></li>
			</ul></li>
		<li><a target="_blank" href="http://www.amazon.com/b/ref=as_li_qf_br_sr_tl?_encoding=UTF8&camp=1789&creative=9325&linkCode=ur2&node=1000&tag=ebookread09-20&linkId=264YVKGWIQ45Z2AT">Books  </a></li>
		<li><a href="banners.php">Banner Ads  </a></li>
		<li><a href="comp.php">Computer Hardware  </a></li>
		<li><a href="software.php">Computer Software  </a></li>
		<li><a class="qmparent" href="javascript:void(0);">Consumer Electronics  <img src="images/arrow_4.gif"></a>

			<ul>
			<li><a href="cecell.php">Cell Phones  </a></li>
			<li><a class="qmparent" href="javascript:void(0);">Computers  <img src="images/arrow_4.gif"></a>
<ul><li><a href="cecompdesk.php">Desktop</a></li>
<li><a href="cecomplaptop.php">Laptop</a></li></ul>
</li>
			<li><a href="cetablet.php">Tablets  </a></li>
			<li><a href="cetvs.php">T.V.'s  </a></li>
			</ul></li>

		<li><a class="qmparent" href="javascript:void(0);">Footwear  <img src="images/arrow_4.gif"></a>

			<ul>
			<li><a href="footwearkids.php">Kids</a></li>
			<li><a href="footwearmens.php">Men</a></li>
			<li><a href="footwearwomens.php">Women</a></li>
			</ul></li>
		<li><a href="health.php">Health and Beauty  </a></li>
		<li><a class="qmparent" href="javascript:void(0);">Jewelry  <img src="images/arrow_4.gif"></a>

			<ul>
			<li><a href="jewelrybrac.php">Bracelets</a></li>
			<li><a href="jewelryearr.php">Earrings</a></li>
			<li><a href="jewelryneck.php">Necklaces</a></li>
			<li><a href="jewelryrings.php">Rings</a></li>
			<li><a href="jewelrywatches.php">Watches</a></li>
			</ul></li>
		<li><a href="linen.php">Linens / Home Decor   </a></li>
		<li><a target="_blank" href="http://www.amazon.com/b/ref=as_li_qf_br_sr_tl?_encoding=UTF8&camp=1789&creative=9325&linkCode=ur2&node=195209011&tag=ebookread09-20&linkId=L63U2CKHTQA6QEZI">Music  </a></li>
		<li><a href="office.php">Office Supplies  </a></li>
		<li><a href="toys.php">Toys / Video Games  </a></li>
		<li><a target="_blank" href="http://www.amazon.com/b/ref=as_li_qf_br_sr_tl?_encoding=UTF8&camp=1789&creative=9325&linkCode=ur2&node=130&tag=ebookread09-20&linkId=3WYCXF6H6PM6RS62">
Video DVD's  </a></li>
		</ul></li>

<li class="qmclear"> </li></ul>

</td> 
  </tr> 
</table> <center>

Sure don't mind at all :)

 

I have all my pages set to .php extension

I have about 20 ish pages that each have <?php include'header.php?> and for the footer also

the one I am trying to get to work is a test page, I test everything on test3.php before I put it up...so I can play with it

if you want to go look at it to see what I mean it is www.loadsofads.com/test3.php

all the rest that are working are in the root

please don't mind all this messy code, I do everything slowly and once it works I clean it up ;)

Edited by enemeth

My first instinct is that php is not on the server or not configured.

 

Could be that you need to add a line in .htaccess or in the apache configuration file to handle php with php pages

Something like:

AddType application/x-httpd-php .php .phtml .htm .html

or

AddType application/x-httpd-php5 .php .phtml .htm .html

or even possibly add the php version

AddType application/x-httpd-php53 .php .phtml .htm .html

Now if you actually just make a php file named phpinfo.php in the root folder and use only this code......what do you see when visit http://www.loadsofads.com/phpinfo.php

<?php phpinfo();?>

Did you ever consider trying to use a template engine like twig or smarty , maybe even install a premade cms and modify it like wordpress , joomla etc?

 

Additional observation on all pages was that there is no opening html or doctype declaration shown

Sample html5 layout:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Title</title>
<meta name="description" content="My meta description">
<meta name="keywords" content="all,my,keywords">
<link rel="stylesheet" href="style.css">
</head>
<body>
Body content
</body>
</html>

ok so I did the phpinfo.php and wow a lot of information came up, I wish I could read it lol

 

as for the doctype and all that on the pages, I am going to add it :) thank you!

 

and the twig and smarty suggestion I will read them and check it out, you have to realize though I am not a coder ;) I see code and see what it does and put it in, and if it isn't doing what I want it to do I move around stuff to make it work with help from documents on the internet and little things I picked up through out my years of doing this.  Maybe you can say I am a newbie in all this, but I really do have fun with it all..i guess that's all that counts :) when it gets to technical and in deep I come here and try and get some help , works great in the end though, always :)

Try this code instead:

<?php include('header.php');?>


<style type="text/css">
  body {
    margin:0; padding:0;
    font:.75em/1.5 sans-serif;
    }

  h4  {
    font-size: 1em;
    }

  .column-in {
    margin:0; padding:10px;
    }

  .cleaner {
    clear:both;
    height:1px;
    font-size:1px;
    border:none;
    margin:0; padding:0;
    background:transparent;
    display:none;
    }

  #container {
    width: 80%;
    padding:0;
    display: table;
    border: 1px solid black;
    }

  #row  {
    display: table-row;
    }

  #left {
    width:150px;
    padding:0;
    background: #EEF;
    display: table-cell;
    background:yellow url("red.gif") top left repeat-y;
    }

  #middle {
    padding: 10px;
    background:white;
    display: table-cell;
    font-family:bookman old style;
    font-size:8px;
    }
</style>

</head>

<body>

<div id="header"><div class="column-in">
  <p><a href="http://www.snook.ca/archives/000177.html">Return to article</a></p>
</div></div>

<div id="container"><div id="row">

  <div id="left"><div class="column-in">
    <h4>Categories</h4>
    <p id="lccont">
Menu Items
List
List
List
List
List
List
List
List
List
List
List
List
List
    </p>
  </div></div>

  <div id="middle"><div class="column-in">
    <h4>Middle Col</h4>
    <p id="mccont">
<table border="0" width="67%" height="177">
  <tr>
    <td width="100%" height="109"><img src="http://www.tqlkg.com/image-7653886-11189232?imgurl=http%3A%2F%2Flitbimg.rightinthebox.com%2Fimages%2Fl

%2F201407%2Fwqvg1406510417968.jpg"> <br></td>
    <td width="70%" height="171" rowspan="2">     </td>
    <td width="130%" height="109"><img src="http://www.lduhtrp.net/image-7653886-10677699?imgurl=http%3A%2F%2Flitbimg.rightinthebox.com%2Fimages%2Fl

%2F201403%2Fvrkkti1396257446087.jpg"></td>
    <td width="100%" height="171" rowspan="2">     </td>
    <td width="100%" height="109"><img src="http://www.awltovhc.com/image-7653886-10677699?imgurl=http%3A%2F%2Flitbimg.rightinthebox.com%2Fimages%2Fl

%2F201408%2Frpriff1409044325841.jpg"></td>
  </tr>
  <tr>
    <td width="101%" height="62">
      <p align="center">Name of Item<br>$149.99<br><title="All the description would go here so people can get a quick description of an item">Quick
      Info</p>
      <p align="center"><img border="0" src="images/button.png" width="120" height="44"></p><div class="srtgs" id="rt_linen"></div>
    </td>
    <td width="133%" height="62">
      <p align="center">Name of Item<br>$149.99<br>Quick Info</p>
      <p align="center"><img border="0" src="images/button.png" width="120" height="44"></p><div class="srtgs" id="rt_linen"></div>
    </td>
    <td width="102%" height="62">
      <p align="center">Name of Item<br>$149.99<br>Quick Info</p>
      <p align="center"><img border="0" src="images/button.png" width="120" height="44"></p><div class="srtgs" id="rt_linen"></div>
    </td>
  </tr>
</table>
<table border="0" width="67%" height="177">
  <tr>
    <td width="100%" height="109"><img src="http://www.tqlkg.com/image-7653886-11189232?imgurl=http%3A%2F%2Flitbimg.rightinthebox.com%2Fimages%2Fl

%2F201407%2Fwqvg1406510417968.jpg"> <br></td>
    <td width="70%" height="171" rowspan="2">     </td>
    <td width="130%" height="109"><img src="http://www.lduhtrp.net/image-7653886-10677699?imgurl=http%3A%2F%2Flitbimg.rightinthebox.com%2Fimages%2Fl

%2F201403%2Fvrkkti1396257446087.jpg"></td>
    <td width="100%" height="171" rowspan="2">     </td>
    <td width="100%" height="109"><img src="http://www.awltovhc.com/image-7653886-10677699?imgurl=http%3A%2F%2Flitbimg.rightinthebox.com%2Fimages%2Fl

%2F201408%2Frpriff1409044325841.jpg"></td>
  </tr>
  <tr>
    <td width="101%" height="62">
      <p align="center">Name of Item<br>$149.99<br><title="All the description would go here so people can get a quick description of an item">Quick
      Info</p>
      <p align="center"><img border="0" src="images/button.png" width="120" height="44"></p><div class="srtgs" id="rt_linen"></div>
    </td>
    <td width="133%" height="62">
      <p align="center">Name of Item<br>$149.99<br>Quick Info</p>
      <p align="center"><img border="0" src="images/button.png" width="120" height="44"></p><div class="srtgs" id="rt_linen"></div>
    </td>
    <td width="102%" height="62">
      <p align="center">Name of Item<br>$149.99<br>Quick Info</p>
      <p align="center"><img border="0" src="images/button.png" width="120" height="44"></p><div class="srtgs" id="rt_linen"></div>
    </td>
  </tr>
</table>
    </p>
  </div></div>
  <div class="cleaner"> </div>

</div></div>


<?php include('footer.php');?>
Edited by QuickOldCar
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.