Re: If statement spaning files
| From: | Tom Carter | Date: | Sun, 16 Jul 2000 11:53:03 +0000 |
| Subject: | Re: If statement spaning files | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-6812@lists.php.net to get a copy of this message | ||
If the reason for not wanting to put the condition on every page is that
it is quite complex you could set a flag variable in header.inc, check its
status in the main document... shouldn't be *that* hard.
As for opening and closing brackets in difference includes... I'm not
sure, but I would be vrey surprised if that worked (which it sounds like
it doesn't)
HTH,
Tom Carter
Web Programmer
roundcorners.com
On Sun, 16 Jul 2000, Meir Kriheli - MKsoft wrote:
> I have a several files which include header.inc at the start
> (after setting some vars), and footer.inc at the end of the page.
>
> I want to start an if statment at header.inc and close it
> at footer.inc.
>
> something like
>
> body.php
> -----------
>
> <?
> set some vars...
> include ('header.inc');
> ......
> ......
> ......
> include('footer.inc')
> ?>
>
> header.inc
> -----------
> <?
> if (condition) {
> ?>
>
> footer.inc
> -----------
> <?
> }
> else {
> .......
> }
> ?>
>
> But that gives my syntax error in header.inc. From this i guess
> that included files are parsed as a whole before inserting them into
> the page. Is this correct ?
>
> Is there another solution (require ?), or do I have to put the condition
> on each page (I'd hate to do this)
>
> Thank you
>
> Meir Kriheli
> MKsoft computer systems
>
> 'There's someone in my head but it's not me" - Pink Floyd
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>