One conf per repo in Gitolite using include

Gitolite gives you finely grained access permission control for multi-user and multi-repo Git installations. To reduce future complexity and increase automation options, I've changed the gitolite.conf to accept multiple sub-conf files.

PHP SOAP XML attributes & namespaces with XMLWriter

If you've experienced the unending joy of attempting to make a PHP SOAP call using the SoapClass, you may have discovered XML node attributes cannot easily be created and passed.

Basic JSON request/response in PHP

A friend of mine is writing an iOS application which will communicate with a web server. He needed a basic JSON program to test out his code, so I wrote him this:

PHP array_insert_after() & array_insert_before()

I need to insert a key/value at a certain position in an associative array. It seems like a common issue. I was surprised to discover there wasn't a straightforward answer. Here is the method I created. If you know of a more efficient method, please let me know in the comments.

Cleanest/simplest method to render image fields with Drupal 7

A common issue when building a site in Drupal: you've got a $node, $vars['node'], or $form_state['node'] and need to render an image (with image style) from one of the fields. I am building a custom form in this instance, and need to show the first image stored in some loaded nodes.

  // Get the node loaded via node_load into $node.

Field tokens are effectively available in Drupal 7

Update: Dave Reid just added basic field token support to Token. Try the beta4 of Token (http://drupal.org/project/token) before Entity Tokens. I worked out what needed to happen a few weeks ago, and finally wrote it up. I didn't realize there was an update the Token when I posted. Haha! Internet moves quick!

Get the renderable array for a single field instance

I'm building an interface to simplify the user experience during content creation. Users select options in three <select> fields, then on submit, they are forwarded to the correct content type add node form for the options selected. Some of the values from the original form will be be pre-filled in the new node add form.
To create this new form, I need fields from the content types and user profile. Given a content type, field name, and field instance, this is the code you need to get the Form API renderable array for the field.

ASCII control characters escape sequences in iTerm

Normally I work in Windows or Linux. Currently, I am working on an iMac. Rather than fighting years of muscle memory, I switched the Command and Control keys in the Keyboard preferences. Problem is now Control keys in iTerm don't work. After some research I determined how to send Control characters with both Command and Control.
Note: I know this could use some screenshots. No time right now.
Here is how to make Control-C work in iTerm when Control/Command have been switched:

Render/embed a Panels Page in a jQuery Dialog Box

I need a page on my Drupal 7 project site to display within a jQuery modal dialog box. Adding content to a jQuery dialog is straightforward with the Dialog module. The issue was the dialog box needed to contain the contents of a Panel. Previously I've embeded Views using views_embed_view(), but I've never tried to embed a Panel. A web search wouldn't give me a quick answer, so I worked it out.

Pages

Subscribe to Front page feed