Page 1 of 1

newbie question

Posted: Thu Jun 13, 2002 2:07 am
by 9902468
I have pure php in my include file. Do I have to have / is it allowed to have. <?php and ?> tags in my include file? Include code looks like this:

<?php
require_once 'all_fun.php';
?>

And all_fun.php like this

<?php
all_fun_contentshere
?>

If I understand correctly PHP outputs everything from my include file to the place where require_once is called... So the code is effectively like this?

<?php
<?php
all_fun_contentshere
?>
?>

Someone said to me that include files must have those tags too, but i think that they are futile, perhaps even a mistake? What PHP does when it encounters nested php tags?

thanks for the info

-9902468

Posted: Thu Jun 13, 2002 2:14 am
by Peter
Included files have to have the <? ?> tags or ASP tags (if enabled) in order to make php parse the files... otherwise it'll just include the file as text. include() and require() don't only include php files... there would be no point in parsing non-PHP files. ;)

Posted: Thu Jun 13, 2002 2:27 am
by 9902468
My bad again. yep thanks

Posted: Thu Jun 13, 2002 6:39 am
by jason
Peter: However, the preferred style is <?php ?>, the full tags. They will always work, as the other two won't.