Page 1 of 1

How to exclude file from particular pages?

Posted: Wed Jan 05, 2011 9:39 am
by samuel13
Hello all,

I am new here so please forgive the coding language.

I am working on a clients site that someone else created in php. I need to exclude a file that is included in my index.php from all pages except the index page itself.

In my index.php it includes the header.php for the site. The header.php file includes a Topnav.php file. The TopNave.php file is what I need to exclude from all pages except the index (home) page.

Could someone help me understand how this can be done?

Here is the code in my Topnav.php file -

Code: Select all

<div id="greenStripe"> <img src="/_images/bannerGreen.jpg" width="895" height="26"/> </div>
<div id="flash">
    <?php
    include "flashObject.php";
	?></div>
<div id="topNavContainer" style="width:895px">
<?php
	include "topNav.php";
?>
</div>

Re: How to exclude file from particular pages?

Posted: Wed Jan 05, 2011 10:10 am
by jankidudel
In the header.php file just remove line where it includes your not wanted file, in index.php include it manually

Re: How to exclude file from particular pages?

Posted: Wed Jan 05, 2011 10:13 am
by social_experiment
You could simply remove include 'topNav.php' from all the pages except index.php. Removing the page (topNav.php) will result in errors from the include() function.

Re: How to exclude file from particular pages?

Posted: Wed Jan 05, 2011 10:30 am
by samuel13
jankidudel wrote:In the header.php file just remove line where it includes your not wanted file, in index.php include it manually
This worked perfectly! I thought that if it is included in the index.php, that it would be on all my pages...? Guess not.