[thelist] PHP inside or outside?

Tony Crockford tonyc at boldfish.co.uk
Sat Apr 24 15:44:30 CDT 2004


At 19:40 on Saturday, 24 Apr 2004, Richard Harb wrote:

> echo '<a class="lightright" href="description_view.php?idc_ref=' .
> $parent_ref . '" title="go back">Back to Description</a>';
>
> The advantage I see is that it's pretty clear to read, and it 'might'
> give you a speed improvement as well as the parser does not need to
> evaluate the string within the single quotes.

Yeah, I see that and sometimes that's teh way to go unless I'm mixing in  
javascript and then it really gets me confused!.

Maybe I'm misunderstanding the way PHP works?

if I have twenty lines of xhtml and one line with a PHP variable in it,  
how does the parser work - doesn't it just pass the xhtml to the browser  
directly and only parse within <?php ?>

most times I'm making an xhtml template, getting it to work and then  
adding the php logic, so it seemed to make sense to only use php where I  
really needed it and not for all the xhtml templating.

Is my understanding screwed?

tia

Tony


More information about the thelist mailing list