Page 1 of 1

Another newb question

Posted: Wed May 12, 2004 1:12 pm
by Fusion
so were does the code in a php include get executed...is it like so:

Code: Select all

<div id="Footer">
<?php
$foldersin = 1;
include('../footer.inc') ?>
<img src="<?php echo $pre; ?>images/footer.jpg" alt="" height="107" width="800" border="0">
</div>
</body>
</html>
or like so:

Code: Select all

<div id="Footer">
<?php
$foldersin = 1;
include('../footer.inc')
<img src="<?php echo $pre; ?>images/footer.jpg" alt="" height="107" width="800" border="0">
</div>
</body>
</html>
 ?>
in other words, is my <?php echo $pre; ?> being canceled out by the include because you cant have a php tag inside another?

Posted: Wed May 12, 2004 1:15 pm
by magicrobotmonkey
The first one

Posted: Wed May 12, 2004 1:27 pm
by launchcode
Try it and see? The 2nd one will give you a syntax error.

Posted: Wed May 12, 2004 2:09 pm
by Fusion
Try it and see? The 2nd one will give you a syntax error.
I know it gives me a syntax eror, im trying to figure out witch one the server out puts if it did show the php code and HTML. but i am thinking the first one also, thanks a bunch

Posted: Wed May 12, 2004 2:26 pm
by patrikG
You can't have nested php-tags.

Posted: Wed May 12, 2004 2:54 pm
by launchcode
The first one is correct because you jump in and out of PHP in the correct sequence.

The second one you never end your PHP block - you cannot have HTML embedded into your PHP in that manner without either echoing/printing it in some way. Anything between the <? ?> tags must be valid PHP code and "</div>" isn't, for example. Hope that makes more sense.