- Grew a moustache for the Envato Movember competition
- Community Moderator
- Contributed a Blog Post
- Author was Featured
- Item was Featured
- Won a Competition
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Has been a member for 4-5 years
Forgot to add 1 more question to my above list:
- How do you handle complicated SQL queries (hardcore joins etc..) using a database abstraction layer?
- Grew a moustache for the Envato Movember competition
- Community Moderator
- Contributed a Blog Post
- Author was Featured
- Item was Featured
- Won a Competition
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Has been a member for 4-5 years
If you can do easy and generic invoicing / payment tracking and PDF invoicing u’ll make a killing.
This is the most requested feature on a simple crm
- Grew a moustache for the Envato Movember competition
- Community Moderator
- Contributed a Blog Post
- Author was Featured
- Item was Featured
- Won a Competition
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Has been a member for 4-5 years
A pet peeve of mine is when people continue to use the simple mysql_query for large projects. There are much better alternatives.![]()
fork(); http://codecanyon.net/forums/thread/php-database-abstraction-layer-advantages-disadvantages/29179
- Grew a moustache for the Envato Movember competition
- Community Moderator
- Contributed a Blog Post
- Author was Featured
- Item was Featured
- Won a Competition
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Has been a member for 4-5 years
Have a read of this little post against db abstraction: http://jeremy.zawodny.com/blog/archives/002194.html
My question to other coders out there, how do you tackle database connections and queries in large php applications?
- Is your code full of mysql_query(“SELECT * FROM ….”); snippets?
- Do you have your own home-brew database class/functions/abstraction layer?
- Do you use one of the popular PHP database abstraction layers out there?
- Grew a moustache for the Envato Movember competition
- Community Moderator
- Contributed a Blog Post
- Author was Featured
- Item was Featured
- Won a Competition
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Has been a member for 4-5 years
Downloading Aptana 3 now. Got a little project to work on tomorrow, might give myself a day in Aptana to test it out (haven’t heard of it before).
edit: oh dear.. eclipse .. projects… arrghh… * confused * i just want to open a folder and start coding
- Grew a moustache for the Envato Movember competition
- Community Moderator
- Contributed a Blog Post
- Author was Featured
- Item was Featured
- Won a Competition
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Has been a member for 4-5 years
What’s your favourite PHP IDE ?
Zend Studio 5.5
By far the fastest and feature rich IDE released. I can code PHP a million miles an hour using this beast. Unfortunately Zend dropped this for an eclipse based IDE in version 6 (huge mistake). But I still keep 5.5 around for the quick bit of coding.Anything eclipse based
Yuk! * delete *vim/emacs/notepad fans
Install PhpStorm (below)! You’ll pump out higher quality code faster.
PhpStorm
This is new on the block, and I’ve been using for about 5 months now. This is by far my new favourite. It does lack a few features that Zend 5.5 has, but is under heavy development and they really do listen to their forum users requests. The company behind this has been building IDE ’s for years, very good.Some of the features I like in an IDE :
(at the moment PhpStorm ticks almost all of these):- Been able to Ctrl+click on a variable, method or function. The IDE will open the file where that was declared and take you to the line number so you can edit it.
- Been able to Ctrl+click on pretty much everything else (eg: css class, css id, javascript function) and the IDE will take you to where that was defined so you can edit it.
- Refactoring: rename a php variable/php method/php function/javascript function/css class/html id/ once and it will update every relevant usage of that element to the new one.
- AutoCompletion: the IDE will give you a list of valid things you can type (eg: functions/methods) once you start typing. PhpStorm can autocomplete crap loads, javascript functions, json elements, jquery, jquery plugins (yup! it reads jquery plugins and gives you valid method()’s you can apply to a jquery object), css classes, html attributes, everything!! and if it doesn’t find something (eg: $myClass->method(); ) you can click it and it will go and make it for you. Makes extreme programming fast.
- Find replace in path: an easy way to find/replace text or regex in a list of files.
- Code formatting: if you have a mixed HTML /PHP/JS file there should be a button that indents all the code in a standard way.
- Block commenting: an easy one, select some text, Ctrl+/ should comment that block out (in the selected text’s native programming language )
- Content duplication: pressing Ctrl+d on a line will copy that line to the one below. (same concept for selected block of text). This doesn’t interfere with the copy/paste buffer and makes coding so much easier.
- Word wrap: nice to have. surprising number of java based IDE ’s don’t have this.
- FTP integration: dislike having to open a separate program to upload files. The IDE should have some basic upload method.
- Version control integration: Ability to easily interact with your favourite version control. Should have all the mod cons including diff and the ability to see a files version history.
So, what’s your fav IDE and why?
- Grew a moustache for the Envato Movember competition
- Community Moderator
- Contributed a Blog Post
- Author was Featured
- Item was Featured
- Won a Competition
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Has been a member for 4-5 years
Passing / modifying superglobals incorrectly
My fav, I got into a fight over this one and caused some jobs to be lost
Passing super globals (like $_POST, $_GET, $_REQUEST) into a function, without adjusting the superglobal variable name. Similar code was in every function in the entire huge crappy app.
some_function($_POST);
function some_function($_POST){
$_POST['foo'] = 123;
}
This is wrong on so many levels. Like, urgh, re-declaring $_POST in the local function scope. Like. argghh. anywho.
- Grew a moustache for the Envato Movember competition
- Community Moderator
- Contributed a Blog Post
- Author was Featured
- Item was Featured
- Won a Competition
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Has been a member for 4-5 years
try to use the correct HTML markup tags instead of span with a class
reason: cross browser nightmare ! and try not to name classes the same as HTML tags. confusing!
Original html code
<span class="h2">Some Text</span>
New html code
<h2>Some Text</h2>
(apply your css styles to “h2” instead of ”.h2”)
- Grew a moustache for the Envato Movember competition
- Community Moderator
- Contributed a Blog Post
- Author was Featured
- Item was Featured
- Won a Competition
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Has been a member for 4-5 years
Limit using ‘print’ or ‘echo’ to spit out large blocks of HTML code:
reason: when your IDE has some nice HTML features, it cannot apply these to php strings.
for example, in the below string there is a html error (an additional ” in the view link) which is not picked up by the IDE until we take this html out of a php string:
Original PHP
print '
<td>
'. $row['sent_dt'] .'
</td>
<td>
'. $row['subject'] .'
</td>
<td>
'. $row['to'] .'
</td>
<td align="center">
<a href="composeemail.php?email_id='.$row['email_id'].'"">View
</td>';
New PHP
?>
<td>
<?php echo $row['sent_dt'];?>
</td>
<td>
<?php echo $row['subject'];?>
</td>
<td>
<?php echo $row['to'];?>
</td>
<td align="center">
<a href="composeemail.php?email_id=<?php echo $row['email_id'];?>">View</a>
</td>
- Grew a moustache for the Envato Movember competition
- Community Moderator
- Contributed a Blog Post
- Author was Featured
- Item was Featured
- Won a Competition
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Has been a member for 4-5 years
Accidental assignment within if statement:
This happens all to often, I just found one today in some code I’m fixing.
The error looks like this:
if($_REQUEST['action'] = 'delete'){ // run the delete code...
Of course, delete will run every time. This should be:
if($_REQUEST['action'] == 'delete'){ // run the delete code..
An even better practice to get into is swapping the variables around:
if('delete' == $_REQUEST['action']){ // run the delete code..
This way if you do accidentally use = instead of == you will get a PHP error.
It’s a hard practice to get into, but well worth it in the long run.
