Re: seperating php code from html?

From: Date: Mon, 14 Apr 2003 07:04:29 +0000
Subject: Re: seperating php code from html?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-143719@lists.php.net to get a copy of this message
"Prince" <friendly@kaltelnet.net> wrote in message news:001e01c30239$38338dc0$2104a40c@andy... > hi... > > i heard that it was better if when writing php to keep as much of the php > code away from the html source as possible... or at least have as little > html code in the php scripts as possible.. but either way it goes was just > told to keep the 2 apart from each other as much as possible.. > > so given that fact > > > 1. is that a true statement i should try to follow? or doesnt it really > matter I think it is wise to follow that statement. > 2. is it ok to write code that would maybe take up 15 lines or so and turn > it into 1 or 2 lines? as long as you are not doing something unnatural, 2 lines are less likely to have fewer errors. But if you are trying todecide weather to use 3 or 4 lines, but 4 lines are much better communicating what the code is doing use 4 lines. > 3. is code better written where the person who wrote it and everyone else > can read it or should it be written for speed .. The code should be readable, and talk to the reader as much as possible. The speed (where necessary) should be achieved by better algorithm and organization (which would usually also improve readibility). Also bear in mind that: "Premature optimization is root of all evil" Meaning that you should optimize things only where necessary, not just because you could. rush -- http://www.templatetamer.com/

« previous php.general (#143719) next »