On 5/14/09 2:52 PM, "Shawn McKenzie" <nospam@xxxxxxxxxxxxx> wrote: > PJ wrote: >> I'm a bit fuzzy on the relationship between the <? ?> and the HTML code. >> Where should the php code be placed in a page so that execution is >> carried out smoothly? So far, my coding has managed to avoid horrendous >> snags; but as I delve deeper into the quagmire of coding, I would like >> to clear the fog before me. >> Perhaps I have been fortunate up to this point... :-) >> > > Well, you place the php code wherever you want it executed. The file is > parsed line by line top to bottom, so if you have some html for an image > and you want the php to be executed before the image, then you must > place it before the image and vice versa. that's correct. another possibility is to use a template system. i like this because you can have the html code and php code in separate files, which i find easier to deal with. thus php files always begin with <?php and end with ?> and that's the only place those tags are seen. the separation is not 100% clean since there can be fragments of html inside php strings where the php script generates html to put into the template. you can find some template libraries in pear. and there are general purpose php app frameworks that incorporate template (aka layout) schemes. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php