Exclude content when using include
Moderator: General Moderators
Exclude content when using include
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
If statements? Based on the limited information you posted that's the best help I can give.
Re: Exclude content when using include
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
Page when included
Original page
Code: Select all
Page content
<section>
Section content
</section>
Code: Select all
Page content
Re: Exclude content when using include
Right... define a variable in your 'including' file - i.e. the one which is including the other:
And then in your included file:
Code: Select all
$isIncluded = true;Code: Select all
Display this bit.
And this bit.
<?php if(!isset($isIncluded)) { ?>
But not this bit.
<?php } ?>