| 
	
 | 
 Posted by farrishj@gmail.com on 05/28/07 18:08 
On May 28, 12:45 pm, Michael <MichaelDMcDonn...@yahoo.com> wrote: 
> ============================= 
> Yes, the text "browser interpreter" should replaced by "interpreter". 
> In any case, it would seem that the question is still valid. Any 
> comments would be appreciated. 
> MDM 
 
I think I see what you're getting at. If you include a file, you still 
need parser instructions for the contents of the included file, since 
the include file can have processor directives just the same as the 
including script does. To wit: 
 
<code file="index.php"> 
<?php 
include 'html-header.inc.php'; 
include 'main.inc.php'; 
include 'html-footer.inc.php'; 
?> 
</code> 
 
<code file="html-header.inc.php"> 
<html> 
<head><title><?php echo COMPANY_NAME; ?></title></head> 
<body> 
<?php include 'company-header.inc.php'; ?> 
</code> 
 
<code file="main.inc.php"> 
<?php 
$inc = '/LIB/section-'.$_GET['section'].'inc.php'; 
include $inc; 
?> 
</code> 
 
<code file="html-footer.inc.php"> 
<?php include 'company-footer.inc.php'; ?> 
</body> 
</html> 
</code> 
 
So as you see, you have to have <?php ?> tags on included content, as 
that included content may still contain a mix of processor directives 
and hard-coded data (like html). 
 
Incidentally, you really only need <?php if a page is all php; the 
parser will close the file and auto-insert a ?> to finish. However, I 
generally this to be bad practice and always insert it anyways.
 
  
Navigation:
[Reply to this message] 
 |