The other day I was approached by a friend (Julie Cheung) and asked if I could create some code that would display a list of last played tracks from last.fm. Julie isn't a PHP developer and so the code I gave her had to be easily understandable so that she could edit it herself if needed. The following code is what I came up with.
A tabledrag form in Drupal 6 is any form that will allow you to move items up and down the list or into a hierarchy of items. This is actually a component of Drupal itself and is used on forms like menu, taxonomy and blocks management. Tabledrag is a great way of allowing your users to move items up and down a list with ease and they will be used to the mechanism from other areas of the site.
I needed to create a tabledrag form in a recent project, but after not finding many good tutorials about creating a fully working form online I decided to write one. This will take you through the basics of what you need to get a weight based tabledrag form working and will also leave you with a working module.
Understanding what it is that the client needs is an integral part of software development. The client will usually help you out by telling you what they need the system to do. What you will generally have is a big list of the things that the system should do. Rather than explain the difference between the terms "function requirements" and "non-functional requirements" to the client, you can save time by using MoSCoW. This is an abbreviation for Must, Should, Could, Won't and can also be written as MSCW or a number of different ways. I prefer the addition of the o's as it makes it more easy to communicate the idea to clients. The idea behind MoSCoW is to go through everything that the client wants the system to do and applying one of the four terms to that feature.
Phing allows the running of SSH commands on servers and the copying of files to servers via SCP. Before you can use SSH and SCP commands in Phing you need to install the PECL extension SSH2. The SSH2 PECL extension requires the libssh2 package, so you need to install that before you can get started. The following install instructions are based on a Linux environment.
Download the libssh2 package from www.libssh2.org and install it by using the following commands. Your package version may vary.
The 7th, 8th and 9th of October saw the fourth PHPNW conference in Manchester, and I was lucky enough to be part of the team helping out on the day. I spent the day before the conference driving speakers from the airport to the Mercure (formerly Ramada) hotel in Manchester Piccadilly, and only partially getting lost in the convoluted mess of one way streets in the city centre.
In any list of documents in a system it is a good idea to add some thumbnails of the document so that your users can get a quick overview of what a document looks like before downloading it. This is a good alternative to just displaying an icon of the document type.
Creating Word document icons is very simple thanks to a service called LiveDocx. LiveDocx was created as a web service to allow the easy creation of most document formats from a simple template. However, it is possible to send a normal Word document as the template file and get an image of the file in return.
The best way to use LiveDocx with PHP is to use the LiveDocx class contained within Zend Framework. You can use this outside of a Zend Framework application by including the file Zend/Service/LiveDocx/MailMerge.php at the top of your script.
During my work developing Drupal sites I am quite often asked if I can provide a example of form elements for designers. This is so that they can test their designs with all possible form elements that might appear in a Drupal install and make sure that the theme we create will be robust and future proof. I often find myself forgetting how to create, say, a multi select element and needed a sort of cheat sheet that I could look form elements up on.
To this end I sat down and created a list of all of the Drupal form elements and packaged them into a module so that when the path 'form_elements' is loaded a very large form with lots of elements will be rendered. There is even a tabledrag form component in there, which is used quite a bit within the Drupal administration pages.
I was recently setting up a localhost environment with Ubuntu 11 and after adding all of my needed VirtualVost directives I found that I could start/restart the server but that I found the following error when trying to start the server.
- [email protected]:/etc/apache2/sites-available$ sudo apache2ctl -k start
- apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
To fix the problem you needed to add a simple directive to the Apache httpd.conf file. In order to access this file you'll need be have admin access, so open up a terminal window and type the following command.
To desaturate an image means to remove all non-greyscale colours from it, essentially creating a black and white version. To do this you can use the function imagecopymergegray(), which is part of the GD image library. This function is a little difficult to figure out, but what is does is sample one image into another and optionally changing the amount of colours that are kept during the sampling process. The function can be made to sample just a section of the image, or the whole thing. The parameters of the function are as follows.
The input format help text is a good way of telling your users about the sort of content that they can enter into any text area. For some users, however, they can get in the way a little and even cause confusion, especially when WYISYG editors are used as much of the help text will be quite useless to most users.
The input format section is controlled by the Filter module, which is built into Drupal core, and it comes with a couple of handy hooks that allow control over this section. The filter tips section is split into two parts, the actual filter tips text itself and the more info link below the tips. If you want to remove these then just pop the following into your theme template.php file and change the function names accordingly.