KillerPHP Blog

PHP Tips and Tricks

Creating a PHP Survey Form

April 4, 2014

Learn PHP by Building Web Applications

Hi,

We recently had a question on the PHP forums where a guy was trying to create a PHP survey form and though he had bought the Complete Web Programmer package, he did not know which way to go.

All he had to do was do the video course: “PHP and Javascript Form Validation”. Whether you are doing a survey form or a contact form (as we cover in the above course) … it doesn’t matter because it is all the same at the basic level.

The conversation in the forum (PHP forms) fills in more details.

Thanks,

Stefan Mischook
killerPHP.com

read more


Speed up PHP with JSON and AJAX

January 27, 2014

javaScriptLogo

Hi,

So we decided to work on streamlining and speeding up StudioWeb’s basic functionality. When it comes to user perceptions of a web application’s speed, the most important thing to look at is the request/response cycle. But first, the most obvious thing you can do, is to just increase your server’s speed:

  • More RAM
  • More CPU
  • Faster disk drives
  • Empty disk drives – <50% full disk always move much faster.

… New servers are coming very soon to StudioWeb. In the meantime though, there are things you can do the application’s code itself.

AJAX with JSON

StudioWeb makes heavy use of AJAX to submit answers to the server for processing. So we decided to utilize JSON to send the data – rather than posting just a raw strings of text. What we get out of this, is a much faster response time from the users point of view.

To use JSON, you Typically use JavaScript

If you are sending post request via standard post and not AJAX, you can’t take advantage of JSON, since JSON is a function of JavaScript – meaning, it is all about creating JSON objects with JavaScript and the only way to use JavaScript in the request/response cycle, is to use AJAX … or specifically, the XMLHttpRequest() object.

… But now I am getting deep into nerd territory. All you need to take away is that using JSON to pass information to and from a server can speed up things a lot.

Stefan Mischook
killerPHP.com

read more


You know Code but your Design Skills Suck – what can you do!

October 3, 2013

Hi!

I wrote this post originally for killerSites.com but then I figured that PHP programmers are probably the biggest suckers when it comes to page design – in short, you probably need this more than most!

πŸ˜‰

design skills

Hi,

Based on a recent forum post where someone with code skills (HTML, CSS, JavaScript) wanted to improve their design skills … and he was not talking about learning PhotoShop … actual design skills he was concerned about. My answer:

To begin with, look to design principles:

– alignment
– whitespace
– font use
– color use

If you have your page elements nicely lined up, don’t use more than two fonts on the page(!), keep your page colors properly matched (no clashing colors) and give the page a lot of breathing room (good use of whitespace) … that will go a long of making the website look good.

(more…)

read more


PHP Data Type Mismatch Crashes CodeIgniter!

September 21, 2013

Learn PHP by Building Web Applications

Hi,

It’s been a long while since I’ve blogged about anything here … been busy building things.

Refactoring a Prototype

Recently, we were refactoring a PHP/CodeIgniter based project, cleaning up the code from a quick prototype we put out. When you have an idea for a piece of software, it is almost always a good tactic to first put out a rough prototype, to see if it has any legs … will anyone find use in your brilliant new idea?

Get user Feedback ASAP!

Another advantage of quick prototyping, is that you can use user feedback to finetune your app to their needs. I became much more successful as a developer doing things this way, over building a rock solid app from the start. Users will always find flaws in your original ideas and many of your ideas will simply not work … so it’s best to get the app into peoples hands as soon as you can.

(more…)

read more


PHP Programmers must Harness the Power of Laziness

July 5, 2013

Normally people think of laziness as being something negative. Generally it is, but when it comes to programming, laziness can be a virtue. But why?

Programming is all about saving time.

Don’t forget that the whole point of writing software, is to automate some process … to save time. You should carry that forward, into your actual programming as well, where you are always looking for ways to make your code and your coding more efficient. In PHP that can mean:

  • Leveraging PHP libraries – never write from scratch.
  • Learning OOP PHP – harder at first to learn, but in the end, writing OOP PHP will save a lot of time.
  • NOT using PHP when other more efficient options are available.

I think the last point is the only one that needs clarification. PHP is a great language, but sometimes it may make sense to use some outside language or even the server itself to get the job done.

For example, let’s say you need to run a PHP script say every day. The easiest way to get this done would be to run a cron job on your server. This functionality is built into any Linux server and a simple command can be used to run whatever PHP script/page you want:

0 0 * * * php /var/www/vhosts/yourdomain.com/httpdocs/scripts/myphp-script.php

The above cron code will cause the server to run your PHP page every day at midnight.

Some people may want to figure out a way to do this all in PHP, buy why bother when you can get the job done with one line of code?

What we can learn from the lazy?

The larger point is to always look for ways to save time – lazy people naturally look to do this all the time. They don’t equate success with lots of hard work, they equate success with getting the job done as easily as possible – you should too.

… Of course, some lazy bastards are so lazy, that they equate success with doing nothing at all. That doesn’t work to often unfortunately!

Thanks,

Stefan Mischook
killerPHP.com

read more


Building an Effective Online Store

June 18, 2013

Hi,

I wasn’t sure what category to put this blog post in, because it isn’t really about PHP code or even about code in general, but there are a few things to learn from my recent update to the Killervideostore.com website:

  1. If adding something to a page/site DOES NOT have any measurable impact, remove it.
  2. Remember that people tend to skim pages, so keep that in mind when structuring your UI.
  3. Seemingly small things can have a big impact on user behaviour and sales.

Remove the unnecessary:

I am always experimenting with different variations to the layouts of our pages – adding/removing buttons, adding a video, replacing link text to image buttons etc … The thing you should always strive for is simplicity – remove what is not needed. Buttons, videos and images that don’t do anything are actually distracting the user.

We recently added a video in our header, introducing the video store to anyone who cared to clicked on the video … very few did. In fact, only about 6% of bothered. Conclusion: waste of space. And so we removed the video.

Check out the old killervideostore header- with video in place:

killervideoStore-may-2013

.. Just click on the above thumbnail to see what it was like.

Now compare it to the new killervideostore header.

People Skim Pages:

When people come to a website, they skim the pages quickly … unless you catch their attention with something. So you need to remove clutter from the page to increase the chances that people will find what they are looking for.

Little Things can be Big Distractions!

I can’t overstate how important it is, that you make changes to your websites very cautiously … especially when you have something that is working.

Over and over again, I’ve been amazed at how even seemingly simple things, can have a huge impact on user behaviour. For example, we once turned our store pages from a light green to a dark green … and watched sales immediately drop 50%! We then reversed back to our old lighter green and sales jumped right back up.

I hope you found this useful.

Stefan Mischook
killerPHP.com

read more


PHP Tip: Keep your Code Clean!

November 11, 2011

In this not so concise somewhat blathering video I talk about keeping code clean. Applies to not only PHP and HTML, but to all languages like Javascript, Java and your bedroom too.

Stefan Mischook
www.killerphp.com

read more


The 'Good Enough' Principle and PHP

August 31, 2011

Hi,

One of the mistakes web developers make is to spend too much time perfecting the code base in a project. This waste too much time and ignores one very important fact: you need to get the software into the users hands as quickly as possible, so they can give you feedback.

… Most end users/clients have very little idea what they really want before they actually use the software. Once they do get their hands on it, they will be able to give you much more accurate feedback in terms of what the software should do ultimately.

In the following vblog I address this issue, framing it in the ‘good enough’ principle of application development:

Stefan Mischook.
www.killerphp.com

read more


KillerPHP Video Blog – Focused Web Design Learning

February 18, 2011

In this video blog, Stefan goes over 2 major points:

1. Don’t get caught up in nerd-theory rabbit holes, that take up all your time on things that will have little to no impact on your day-to-day web programming or designing work.

2. Learn your nerd craft by creating things that people commonly want … things like shopping carts, customizing a blog etc …

For more information and video tutorials on web design and programming, check out our Killer Video Store and the Killersites Video Tutorial Library!
Note that all of our videos are in a higher quality when purchased.

Thanks,

Jody
Killersites.com

read more


How to build a log in system with PHP.

May 19, 2010

Hi,

I just wanted to announce that we will be releasing a PHP log in system video tutorial within a few days.

Like all our videos, as you learn to build the project at hand, you will be secretly taught reusable PHP techniques and even some dreaded PHP nerd theory! Don’t worry though, the nerd theory will be woven into the videos, so you won’t even notice it seeping into your brain.

Many of the videos will be released on this blog for free, but the whole course (and source files) will only be available to Killersites University subscribers or as part of our upcoming complete web developer training package.

… Yes, a shameless plug but nerds need to eat too (and play video games) so we have so charge you guys a little sometimes!

Follow this blog to keep in touch.

Stefan Mischook
www.killerphp.com

read more