If you are editing a PHP code file on Windows or Linux, make sure your file end-of-line format isn’t Old Mac Format. This could cause problems when executing even if your PHP is flawless.
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
For developers just getting started in Moodle development, testing and fixing 3rd party Moodle plugins which are not currently supported the latest version of Moodle is a great way to get started on your way to learning how Moodle works. These plugins often just need simple fixes, updates to deprecated API calls and stuff like that. Start by browsing through the list of 3rd party plugins and choose a plugin that is of interest to you. If you think it would be useful for you, chances are there are others who would think so too. Next contact the author before you start just to make sure … Continue reading
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. Tips for Using email_to_user() $toUser and $fromUser must be Moodle user objects, not email addresses. The stdClass object must contain a … Continue reading
After spending way more time that I should like to admit trying to get XDEBUG to work with Notepad++ using the DBGp plugin in anything but the simplest of projects, I decided to look for an alternative. I compared features of 9 different IDE’s for PHP development and reading tons of reviews. There are many great IDE’s out there and everyone will have their favourite. My short list ended up including: Eclipse (PDT) 3.5 — Didn’t bother trying it. While I’m sure it’s a fine product, the website is ancient and not user friendly. Way too much work to try and … Continue reading
Moodle 2.3 to 2.6.1+ for Windows comes with pieces of XAMPP 1.7.4. Although it works well, the version of PHP that comes included with it is buggy, lacks some key features for development such as a modern control panel and phpMyAdmin. Here is how you can fix some of the problem and upgrade your environment. Upgrading PHP What prompted me to look into this was that Apache was constantly crashing and the following message appeared my Apache error log: [notice] Parent: child process exited with status 3221225477 — Restarting. Here is how to upgrade PHP: Download PHP 5.3.29 — be … Continue reading
Notepad++ is a great editing tool for web developers. I know many, including myself, who use this together with Adobe Dreamweaver for their HTML development because there are just some things that Notepad++ does better than Dreamweaver including syntax colouring and HTML tag matching. When you first start using Notepad++, it tries to determine the language of your source code using the filename extension. If you are just using a blank unsaved document, it may just treat your HTML code as plain text, offering no syntax colouring or tag matching. To enable these features, you either need to save your file with a … Continue reading
However, in some environments, as soon as you try to make ANY changes to the Weaver II setting: The sub-theme reverts back to the default one. All Weaver II settings are reset with default settings. Backing up and restoring the Weaver II settings works ok however this is probably the only other feature which does work correctly in the theme settings. Since I’ve successfully installed Weaver II on many sites to date, the only thing that is different is the hosting environment. If this is happening to you, the problem may be a result of your hosting companies having tightened PHP … Continue reading