die() php but continuing on to html below the end php tag?

die() php but continuing on to html below the end php tag?

am 13.11.2007 17:50:09 von MS

Hi,

Is there a php function that will stop executing the php code, but do any
necessary clean-up, like die(), and will then go on to process any html in
the file that is below the '?>' end php tag? Both die() and exit() exit
without processing the html after the end php tag.

E.G.

SOME HTML...


SOME PHP...

Call End PHP processing function (jumps to end the page neatly html).

?>

END PAGE NEATLY HTML...


Or must I place the end page html in a php function and call that, say, as
part of a MyDie() function.

Thanks.

Re: die() php but continuing on to html below the end php tag?

am 13.11.2007 17:58:54 von Captain Paralytic

On 13 Nov, 16:50, MS wrote:
> Hi,
>
> Is there a php function that will stop executing the php code, but do any
> necessary clean-up, like die(), and will then go on to process any html in
> the file that is below the '?>' end php tag? Both die() and exit() exit
> without processing the html after the end php tag.
>
> E.G.
>
> SOME HTML...
>
> >
> SOME PHP...
>
> Call End PHP processing function (jumps to end the page neatly html).
>
> ?>
>
> END PAGE NEATLY HTML...
>
> Or must I place the end page html in a php function and call that, say, as
> part of a MyDie() function.
>
> Thanks.




SOME PHP...


die('END PAGE NEATLY HTML...');

?>

Re: die() php but continuing on to html below the end php tag?

am 13.11.2007 18:04:24 von MS

Captain Paralytic emailed this:
> On 13 Nov, 16:50, MS wrote:
>> Hi,
>>
>> Is there a php function that will stop executing the php code, but do any
>> necessary clean-up, like die(), and will then go on to process any html in
>> the file that is below the '?>' end php tag? Both die() and exit() exit
>> without processing the html after the end php tag.
>>
>> E.G.
>>
>> SOME HTML...
>>
>> >>
>> SOME PHP...
>>
>> Call End PHP processing function (jumps to end the page neatly html).
>>
>> ?>
>>
>> END PAGE NEATLY HTML...
>>
>> Or must I place the end page html in a php function and call that, say, as
>> part of a MyDie() function.
>>
>> Thanks.
>
>
> >
>
> SOME PHP...
>
>
> die('END PAGE NEATLY HTML...');
>
> ?>

Thanks. Should I take it that the answer is no?

Cheers.

Re: die() php but continuing on to html below the end php tag?

am 13.11.2007 18:11:34 von Captain Paralytic

On 13 Nov, 17:04, MS wrote:
> Captain Paralytic emailed this:
>
>
>
>
>
> > On 13 Nov, 16:50, MS wrote:
> >> Hi,
>
> >> Is there a php function that will stop executing the php code, but do any
> >> necessary clean-up, like die(), and will then go on to process any html in
> >> the file that is below the '?>' end php tag? Both die() and exit() exit
> >> without processing the html after the end php tag.
>
> >> E.G.
>
> >> SOME HTML...
>
> >> >
> >> SOME PHP...
>
> >> Call End PHP processing function (jumps to end the page neatly html).
>
> >> ?>
>
> >> END PAGE NEATLY HTML...
>
> >> Or must I place the end page html in a php function and call that, say, as
> >> part of a MyDie() function.
>
> >> Thanks.
>
> > >
> > SOME PHP...
>
> > die('END PAGE NEATLY HTML...');
>
> > ?>
>
> Thanks. Should I take it that the answer is no?
>
> Cheers.- Hide quoted text -
>
> - Show quoted text -

What I posted is the way such a thing is implemented in php.

Re: die() php but continuing on to html below the end php tag?

am 13.11.2007 18:19:32 von MS

Captain Paralytic emailed this:
> On 13 Nov, 17:04, MS wrote:
>> Captain Paralytic emailed this:
>>
>>
>>
>>
>>
>>> On 13 Nov, 16:50, MS wrote:
>>>> Hi,
>>>> Is there a php function that will stop executing the php code, but do any
>>>> necessary clean-up, like die(), and will then go on to process any html in
>>>> the file that is below the '?>' end php tag? Both die() and exit() exit
>>>> without processing the html after the end php tag.
>>>> E.G.
>>>> SOME HTML...
>>>> >>>> SOME PHP...
>>>> Call End PHP processing function (jumps to end the page neatly html).
>>>> ?>
>>>> END PAGE NEATLY HTML...
>>>> Or must I place the end page html in a php function and call that, say, as
>>>> part of a MyDie() function.
>>>> Thanks.
>>> >>> SOME PHP...
>>> die('END PAGE NEATLY HTML...');
>>> ?>
>> Thanks. Should I take it that the answer is no?
>>
>> Cheers.- Hide quoted text -
>>
>> - Show quoted text -
>
> What I posted is the way such a thing is implemented in php.

Thanks. Regards, etc..

Re: die() php but continuing on to html below the end php tag?

am 13.11.2007 19:59:17 von nc

On Nov 13, 8:50 am, MS wrote:
>
> Is there a php function that will stop executing the php code,
> but do any necessary clean-up, like die(), and will then go on
> to process any html in the file that is below the '?>' end php
> tag?

No. You have to take care of it yourself, not necessarily using
die(). Something like this would work:



// Lots of PHP here

if ($error == 0) {
// continue as you would
} else {
// display error message or call error handler
}

?>


> Or must I place the end page html in a php function
> and call that, say, as part of a MyDie() function.

You can, although I find it hard to believe this is a useful approach
for a non-trivial application. Dying is usually not a good idea...

Cheers,
NC