Re: 'Pure' php vs 'mixed' (html + php)

From: Date: Mon, 03 Jun 2002 00:42:56 +0000
Subject: Re: 'Pure' php vs 'mixed' (html + php)
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-100348@lists.php.net to get a copy of this message
That's what I meant. I was referring to verification/validation scripts for user inputs. I've made a separate page that runs these routines. I have a feeling I should have incorporated them on the user input page . . . but does it really amtter if they're on another page? Andre On Sunday 02 June 2002 08:32 pm, you wrote: > I'm not sure what you mean... Is it checking that you fill in the > correct values via PHP or that the submission works - or something else? > > Bogdan > > Andre Dubuc wrote: > >Thanks Bogdan, > > > >That's what I thought, but I was beginning to feel 'guilty' the more I > >understood php. It seems to me, from my limited experience, that there's > > much mor chance for error using 'pure' php (as in forgetting ' or " or > > closing with ; -- but . . . > > > >Actually I've found that the 'mixed' is easier to read and understand -- > > less quotes, less 'print' to read with every line. But that's just > > personal taste on my part. > > > >While I'm at it, I've also noticed that coders tend to integrate > >'result' > >pages with the 'calling' page. (That is, I have a text input, and use a > > php function to verify it on the same page). I've tended to keep them > > separate for de-bugging purposes. Should I consider re-writing them as > > well? > > > >Regards, > >Andre > > > >On Sunday 02 June 2002 08:16 pm, you wrote: > >>No *real* reason - just two not-so-important ones: > >> > >>1. Clarity > >>Please compare these two: > >>------ "MIXED" > >><td bgcolor="<?php echo $td_col; ?>" class="<?php echo > >>$prefclass; ?>"> > >><?php $fldcontent=$myrow[0]?$myrow[0]:"no data"; ?> > >><input type="text" name="fname" size="50" > >>value="<?php echo $fldcontent; > >>?>"> > >></td> > >> > >>------ "PURE" > >><?php > >> echo("<td bgcolor='$td_col' > >> class='$prefclass'>\n"); > >> $fldcontent=$myrow[0]?$myrow[0]:"no data"; > >> echo("<input type='text' name='fname' size='50' > >> value='$fldcontent'>\n"); ?> > >> > >>The second is much easier to read and understand, you must agree. > >> > >>2. Speed > >>There's an urban legend saying that switching php tags on and off would > >>slow parsing down. I don't know if that's true and try to write > >>"pure" > >>php as you call it due to the first reason. > >> > >>Bogdan > >> > >>Andre Dubuc wrote: > >>>I've noticed that many people on the list code in 'pure' php, i.e. > >>> > >>><? > >>>print "<input type='text' name='fname' > >>>size='50'>"; > >>> > >>>// etc > >>>?> > >>> > >>>Since most of my code is a mixture (the early stuff is 'mixed' html + > >>>php), I've been wondering why code in 'pure' php? Is there some > >>>compelling reason (that I'm unaware of) for doing so? Should I rewrite > >>>all my earlier code into its 'pure' form? If so, what do I do with the > >>>'<! DOCTYPE . . . > statement -- put it in quotes too? > >>> > >>>I would like to understand the reasons for writing code in this manner, > >>>when all my code works fine, displays great: am I missing something > >>>important here? Btw, I use the 'php' ending for all file names. > >>> > >>>Your thoughts, opinions and suggestions would be greatly appreciated -- > >>>I'd like to do what is best. > >>> > >>>Tia, > >>>Andre -- Please pray the Holy Rosary to end the holocaust of abortion. Remember in your prayers the Holy Souls in Purgatory. May God bless you abundantly in His love! For a free Cenacle Scriptural Rosary Booklet: http://www.webhart.net/csrb/

« previous php.general (#100348) next »