Jump to content

Simple PHP Include Question - I think my host changed something


kirkdickinson
Go to solution Solved by ginerjm,

Recommended Posts

2 minutes ago, ginerjm said:

When you say 'index file' what do you mean?  Are you saying that you are not using any script and letting your system just use the default home page name?  What shows in the address bar when you do run it?  Does it have a .php extension on it or is it an html extension?

When you type in the ?con=xxx what is immediately in front of that?  Show us that whole address bar line.

The site defaults to the index.php as the first page when you get there. The site is completely working now with the old code with the added "full opening tag"

Different pages would be called like this:

http://bbc-kjv.com/?con=about
http://bbc-kjv.com/?con=our_faith
http://bbc-kjv.com/?con=online_sermons

Link to comment
Share on other sites

Ok - index.php is a good thing.  So now show us more of your code.  Hard to debug something when we aren't seeing it all  Unless it is hundreds of lines in which case you have some work to do.  Try adding my echo line to the very beginning of any php code in that file and be sure to move the 2 error checking lines up to the start of the php code as well.

Link to comment
Share on other sites

1 minute ago, ginerjm said:

Ok - index.php is a good thing.  So now show us more of your code.  Hard to debug something when we aren't seeing it all  Unless it is hundreds of lines in which case you have some work to do.  Try adding my echo line to the very beginning of any php code in that file and be sure to move the 2 error checking lines up to the start of the php code as well.

I posted the entirety of my code. The index.php page is this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Bible Baptist Church - Byesville Ohio</title>

<!--[if IE 5]>
<style type="text/css"> 
/* place css box model fixes for IE 5* in this conditional comment */
.twoColFixLtHdr #sidebar1 { width: 230px; }
</style>
<![endif]--><!--[if IE]>
<style type="text/css"> 
/* place css fixes for all versions of IE in this conditional comment */
.twoColFixLtHdr #sidebar1 { padding-top: 30px; }
.twoColFixLtHdr #mainContent { zoom: 1; }
/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
</style>
<![endif]-->
<link href="bbc.css" rel="stylesheet" type="text/css">
</head>

<body bgcolor="#FFFFFF" class="twoColFixLtHdr">
<div id="fb-root"></div>
<script async defer crossorigin="anonymous" src="https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v6.0"></script>
<div id="container">
  <div id="header">
    <?php include ("header.php");?>
  </div>
  <div id="sidebar1">
	<?php include ("menu.php");?>
<p>&nbsp;</p>
<p><a href="https://www.facebook.com/pages/Bible-Baptist-Church-of-Byesville-OH/153672901470035?ref=br_tf"><img src="Images/facebook-logo.png" align="center" width="120" height="43" alt="Visit Us On Facebook"/></a></p>
<p>&nbsp;</p>
<p><a href="https://www.youtube.com/channel/UCe-3wTp8RuIFRY_XfLHIRZg"><img src="Images/youtube-logo.png" align="center" width="120" height="58" alt="Watch Us On YouTube"/></a></p>

<!-- end #sidebar1 -->
</div>
  <div id="mainContent">
   	<?php
		$ext = ".php";
		$id = $_GET['con'].$ext;
		if (file_exists($id))
		{
		include($id);
		} else {
		include("main.php");
		}
	?>
   
   <!-- end #mainContent --></div>
	<!-- This clearing element should immediately follow the #mainContent div in order to force the #container div to contain all child floats --><br class="clearfloat" />
  <div id="footer">
    <p>If my people, which are called by my name, shall humble themselves, and pray, and seek my face, and turn from their wicked ways; then will I hear from heaven, and will forgive their sin, and will heal their land.</p>
    <p align="right">II Chr 7:14 </p>
  <!-- end #footer --></div>
<!-- end #container --></div>
</body>
</html>

Really not much there.

Link to comment
Share on other sites

@kirkdickinsonIf you haven't noticed it yet, there is a warning that shows on your main page when the variable is not set:

Warning: Undefined array key "con" in xxx/index.php on line 45

If you want to fix this, change this line in your page:

$id = $_GET['con'].$ext;

To this:

$id = ($_GET['con']??'main').$ext;

 

Edited by kicken
Link to comment
Share on other sites

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.