Page 1 of 1

Exclude content when using include

Posted: Thu Oct 08, 2009 3:26 pm
by peroyomas
Is there a way to don't include a specific section of a page while using the include function?

Re: Exclude content when using include

Posted: Thu Oct 08, 2009 3:34 pm
by JNettles
If statements? Based on the limited information you posted that's the best help I can give.

Re: Exclude content when using include

Posted: Thu Oct 08, 2009 3:44 pm
by peroyomas
What I want to do is to have a page and when I include it in another page don't include a specific section, that would be viewable by default.

Original page

Code: Select all

 
Page content
<section>
Section content
</section>
 
Page when included

Code: Select all

 
Page content
 

Re: Exclude content when using include

Posted: Fri Oct 09, 2009 1:59 am
by pa28
Right... define a variable in your 'including' file - i.e. the one which is including the other:

Code: Select all

$isIncluded = true;
And then in your included file:

Code: Select all

 
Display this bit.
And this bit.
<?php if(!isset($isIncluded)) { ?>
But not this bit.
<?php } ?>