Archive: October 2009

Search and Replace MySQL Blog entry 20 weeks 5 days ago
Performing a case-sensitive search-and-replace through a table is easy with MySQL when you know how. UPDATE table_name SET table_field = REPLACE(table_field, 'replace_that', 'with_this'); This has proved useful for updating Drupal's files table where the paths are incorrect. I...
Adding body classes in template.php Blog entry 22 weeks 5 days ago
I needed to add a body class for node edit pages. Heres the code for template.php <?phpfunction phptemplate_preprocess_page(&amp;$vars, $hook) {  // node-edit class  if (arg(2) == 'edit') {    $vars['body_classes'] = $vars['body_classes'] .' node-edit';  }}?>
Replace views edit link with image Blog entry 22 weeks 6 days ago
I wanted an edit icon on my views edit node links. Using the views field template I added the following to the template file: views-view-field--edit-node.tpl.php <?php  $output = preg_replace(    '#(<a[^>]*>)[^<]*(</a>)#',     "$1"....