PHP: The Second Bracket Is Optional

Wednesday, October 14, 2009 - 12:55

When writing PHP class or function (basically any file containing only PHP code) files you might have learnt to write them something like this:

class Users

Using Netbeans PHP Code Templates

Friday, September 11, 2009 - 17:27

Netbeans is a great IDE and with every version lots more features are introduced that make it even better. One thing that I like to use is the code templates, which have been available from version 6.5. Code templates allows you to type a simple command and get a section of code. What commands you can use depend on what version of Netbeans you are using and which programming language you focused on. As a PHP developer I usually download the PHP version, which comes with a set of PHP code templates.


Prevent People Messing Up Your Goolge Analytics

Monday, August 3, 2009 - 17:02

After running coding sites for a couple years there is one little problem that really annoys me, so when I set up #! code I resolved to fix it. The issue arises when you use some JavaScript based analytics software that allows multiple domains to be used, like Google Analytics. There is nothing wrong with analytics software that allows this, and it is potentially useful for tracking all manner of things. However, some web masters might not be that good at running sites and will lift code from your site (analytics and all) in order to implement a single widget on their site.


Hide And Unhide Code With PHP

Monday, April 27, 2009 - 10:49

If you are selling a system the last thing you want is for people to copy the system and pass it on for free. There are numerous ways to implement parts of the system that will stop this from happening.

By far the easiest is to create a section of code that is hidden, the removal of which will cause the application to fall over. It could even be as simple as a link back to your site so that even if you give you application away for free, you will always have that link present.


Display JavaScript Source Programatically

Monday, March 23, 2009 - 11:20

If you are running a JavaScript example page you can use the following function that will take the last script element on the page and print it out in a code tag. It uses JQuery to do the work, so you will need to include that library before using this function.