Simple PHP debugging tips

Whether you are just getting started in PHP development or have been at it for a while, here are some tips that will help you troubleshoot when your code isn’t working quite the way it should. Post a comment if you find these tips useful or would like to share your own. I’d love to hear from you. Identifying the PHP function being called The first tip is especially useful if you are working on a larger PHP project where there might be multiple definitions of functions or class methods. You may be surprised to discover that it isn’t the function you … Continue reading

Sending Custom Emails in Moodle Using the email_to_user() Function

You can send custom emails from within Moodle using PHP using your own forms using the email_to_user() function. By the way, did you know that Moodle actually uses the open source PHPMailer behind the scenes? A typical call to Moodle’s email_to_user() function would look like: email_to_user($toUser, $fromUser, $subject, $messageText, $messageHtml, ”, ”, true); This is a very simple version of a very powerful function. For more information about the email_to_user() function, take a look at the source code for function email_to_user in Moodle’s /lib/moodlelib.php. If you wanted to also include an attachment, you would need to also specify the path to the file to attach … Continue reading

Debugging in JavaScript

One of the most popular ways of debugging in JavaScript when you are just getting started is to use the JavaScript alert() and input() functions. However there are times when clicking OK repeatedly can become tedious not to mention time consuming. Here are a few additional advanced JavaScript debugging techniques you can use to help increase your productivity. JavaScript Console API Functions Unlike the alert(), this the console API functions just displays a message in the debugger console and continue execution. For example: console.log(“Total is now: ” + t); There are other useful console API functions for debugging: console.group() console.info() console.log() … Continue reading

Introduction to JavaScript Debugging Techniques using Developer Tools

Most modern web browsers today, like Chrome, Firefox and Internet Explorer, come with an integrated JavaScript debugger. If you’ve never one of these debuggers but do program in JavaScript, it will be well worth the few minutes of your time to learn how to use them and save hours of web development effort. The browsers Developer Tools are typically accessible by pressing F12. Each browser has a similar set of tools but are not all created equal. Some are definitely stronger for some tasks when it comes to JavaScript development. For example Internet Explorer (IE) has a split screen so you don’t … Continue reading