Drupal Security Best Practices When Outputting Text Into HTML

When creating a module in Drupal it is very important to be aware of some security best practices when outputting text into HTML. This helps prevent XSS (Cross Site Scripting) exploits and keeps your code in general good health as it prevents problems with user input like angle brackets or ampersands. Be sure to read… Read more Drupal Security Best Practices When Outputting Text Into HTML

How to Get All the Selected Values from a Multi-Select with jQuery

Need to know how to get all the selected values or text values from a multi select element (drop down)? Its simple with jQuery! Start by declaring an array. One for the values of the multi select element and one for the text values. Well, if you even need the text values from the multi… Read more How to Get All the Selected Values from a Multi-Select with jQuery

PHP and MySQL command line with MAMP on OSX

I found a handy article named “Getting command line access to PHP and MySQL running MAMP on OSX” by  Joaquin Lippincott . It was very helpful for getting PHP and MySQL acces from the terminal on a mac. In addition, one of the comments by Matthew Bacon was about getting the ZEND FRAMWORK up and running… Read more PHP and MySQL command line with MAMP on OSX

MySQL from the Command Line (terminal) in MAMP PRO

To get to the command line for MySQL for MAMP or MAMP PRO just open up you terminal and enter the following:   /Applications/MAMP/Library/bin/mysql –host=localhost -uroot -proot You can see all the databases by using the following command: If you type the MySQL command : USE <table name>  you can then start using that particular… Read more MySQL from the Command Line (terminal) in MAMP PRO

Build Drupal Form Elements BEFOR the AJAX Callback is Called

I just lost two days of productive development time trying to figure out why AJAX was breaking in one of the steps of a form I am building in Drupal. As it turns out, a very important, and not at all obvious, thing to remember when developing a Drupal form is that the Drupal Forms… Read more Build Drupal Form Elements BEFOR the AJAX Callback is Called

How to Get the Path ID (pid) for a Node’s Path Alias in Drupal 7

After searching the internet I found nothing satisfactory for simply finding the Path ID for a node’s alias. I need this this so that I could programmatic update a node alias in a way that keeps the Drupal site installation updated system wide without conflicts. So, anyway here is a simple function to find the… Read more How to Get the Path ID (pid) for a Node’s Path Alias in Drupal 7

Access AJAX Returned Elements with JQuery’s .delegate()

I love the way jQuery handles AJAX. With jQuery you can do so much more with so much less code. So once an AJAX call returns some HTML containing elements that you wish to manipulate further with jQuery how do you access it? You may have noticed that AJAX returned elements are not visible to… Read more Access AJAX Returned Elements with JQuery’s .delegate()

DRUPAL: Broken Teaser (or body) Text Showing Up at the Top of Page.

The output of some of the webpages was spilling out at the top of the page as broken HTML. I knew that the body or teaser was somehow getting printed out prior to the body loading. At first, a friend suggested that the problem was unfiltered use of the $vars[‘node’]->body in the Organic Groups module.… Read more DRUPAL: Broken Teaser (or body) Text Showing Up at the Top of Page.