User login

Drupal Development

Get rid of extra spaces using PHP's preg_replace

Right there in the examples for the php function preg_replace was how to strip whitespace from a string:

<?php
$str = preg_replace('/\s\s+/', ' ', $str);
?>

Ereg replace looks prettier:

<?php
$string = trim(ereg_replace(' +', ' ', $string));
?>

However, Agaric has read in several places that preg_replace tends to be faster.

Resolution

Maintaining referential integrity with Drupal CCK nodereference

Problem: Drupal does not check to make sure a node isn't being used as a nodereference on another node before it is deleted.

Solution: Agaric's own Stefan Freudenberg has created a module to protect from this.

Notes:

Both of these are about the opposite direction:

April Metrowest Drupal Meetup

Dan demonstrated a lot of JQuery goodness.

Kathleen demonstrated DBScripts

  • Keep the database in sync with code
  • Preserve the ability to use the web GUI
  • Rapid development workflow
  • Merge development and production databases

In full, you don't track watchdog, you don't track sessions. But you don't destroy it either. You just don't save it.

Min allows you to save the watchdog data etc.

So if your working on something that has search data

Get the complete base URL for a Drupal site

Certain things in the world of Drupal, such as the the shockwave function, swf(), expect a full, absolute URL path and not the relative path (such as just a slash).

Disabling Drag and Drop into WYSIWYG textarea (where do clients get these requests)

Earl's long quest brought this:

<input name="expQuant0" type="text" size="2" value="1"
onKeyUp="calc_Exp(this.name,this.value,event);"
onFocus="clearbox(this.name,this.value);"
onBlur="setbox(this.name,this.value,'exp');" ondragstart="return
false;" >

"Key is to add ondragstart="return false;" that you dont want dragable, he said.

Multimedia in Drupal: Digital Asset Management

As of 2009 April, Asset module, with no release since 2008 November, seems to have lost momentum in favor of Media module, still in development.

Translating taxonomy terms in Drupal

The use case Agaric runs into most often is how to simply translate the terms, and show the correct translation for the language the content and/or the sitewide language is in (not have multiple vocabularies that apply different terms in different languages).

A thread with a great deal of answers:

Drupal 6: How to translate taxonomy terms?
http://drupal.org/node/335205

The Drupal core issue, including a nice summary by catch sadly missing the links:

Agaric wants Drupal to be able to print its structured data into beautiful documents

Said I, petulantly on instant message:

I want to do everything in Drupal. I want to do estimates by having each section a node with estimated hours and such, and then I want it to be able to print it out in one document and have it nicely formatted.

And I got the Drupal is a hammer speech.

Anyway, I still want it, but sadly no one has done it yet.

There are printer markup languages that are relatively straightforward, right? Would be really sweet to make Drupal output in LaTeX or whatever makes sense.

Making Drupal nids into edit link from your command-line SQL

I wanted to call this post "automating manual changes" but it's hard to get across the meaning of automating parts of the process that keep it manual.

Stolen directly from Growing Ventures Solutions post on migrating a messy Drupal 5 site to D6. (Primarily this post provides you with copyable text where there's had an image.)

Syndicate content