Including a file inside die

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Including a file inside die

Post by nigma »

Hey I would like to include a file inside a die() function.

Like inside this code:

Code: Select all

if (checkLogin() == FALSE) 
{ 

die (
'
<html>
<head>
<title>&#1111; M C 0 ] Login Failed</title>
<link rel="stylesheet" type="text/css" href="layout.css" />
<script language="JavaScript" src="pop_up.js"></script>
</head>

<body>

<div id="Header"><h2></h2></div>

<div id="Content">

Login Failed

</div>

// Would like to include the file here.

</body>

</html>');

Anyone know how to do this?
&#125; 
?>
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Why not try something like:

Code: Select all

<?php
if (!checkLogin()) {
?>
<html> 
<head> 
<title>[ M C 0 ] Login Failed</title> 
<link rel="stylesheet" type="text/css" href="layout.css" /> 
<script language="JavaScript" src="pop_up.js"></script> 
</head> 

<body> 

<div id="Header"><h2></h2></div> 

<div id="Content"> 

Login Failed 

</div>
<?php 
    include 'file.php';
?>
</body> 

</html>
<?php
    exit();
}
?>
instead of having all of that in a die() statement.

Mac
Post Reply