Rock the Drop has the single mission to make others' experiences with Drupal much simpler. As we continue to build custom Drupal sites, we encounter challenging situations that require REAL know-how with the cool blue drop. As our knowledge expands, so does yours.
Stick around... it only gets better.
We are also front- and back-end Drupal Themers, Developers and PHP coders; available for development in NYC and abroad with no limit on size and scope.

Attach an existing file to a node programmatically

 * Code that will enable attachment of a pre-existing file on the filesystem
 * to a node that requires it. 
function attach_file(&$node, $file_location, $lang = 'en') {
  global $doc_base_path;

  $file_location = str_replace('\\','/', $file_location);

  $actual_file = $doc_base_path . "/" . stripslashes($file_location);
  if (!file_exists($actual_file)) {
    print "**** FILE NOT FOUND ****\n";
    print $actual_file;
    print "^^^^ FILE NOT FOUND ^^^^\n";
  } else {

    print "File GOOD\n";
    print "Filesize: " . filesize($actual_file);

Import and Translate Drupal 7 Taxonomy Terms

But you'll never get those pesky entity titles !!

It'll take a bit of doing. And it took me sooo long to work out. Several modules will get you close... but not complete. Infact, I gotta revisit this post because I think it even depends on some detail in the order in which you do things. Perhaps tomorrow.

Here's the awesome Drupal module combination that I end up using:

Attach an Existing File to a Node... Programmatically

and the need to consider languages / translations.

Hi!! I'm excited 'cause I just spent another hour figuring out something that wasn't exactly rocket science... but a fairly obscure solution for my "special case".

killed my menu with hook_menu_alter

Then I couldn't access any admin pages. Meaning of course that I could not then clear my caches... INCLUDING the menu cache to restore it.

Truncating the database cache tables also did nothing to help.

Hindsight tells me I could have investigating rebuilding the registry... maybe.

What fixed it was simply running /update.php

Of course, it helps if you're logged in already as user 1 /admin. I couldn't even log out actually, because that access goes through the menu module as well.

Mess up your modules, Mess up your registry...

and mess up your Drupal site "permanently". Not Really.

I screwed up my Drupal project one day by copying my modules directory and forgetting to move it out of it's parent directory. Details are unimportant.

The point is, I cleared my cache and did a few other things and Drupal started looking for modules in a location that was unavailable. Needless to say (I hope needless anyway), the system and registry tables were out of sync with some of the modules.
Fixing (or so I thought) the registry table manually was unsuccessful.

line 2295 of C:\devstack\www\tourBuilder\includes\

variable_get - Provide a default.. OR ELSE!!

Warning: Invalid argument supplied for foreach() in form_type_checkboxes_value() (line 2295 of ...\includes\

Don't Hack Core

You hear it all the time. Any CMS worth its developers' sweated salt has some system of hooks available to other developers to use for customization of their own projects. What the same CMS would have is an entire commando unit who refuses to use the hooks available because they don't understand them, refuse to rtfm, or simply feel like hacking core is the right, easier, or *whatever-they'll-never-try-to-upgrade-anyway* way to go... or something like that.

The bottom line is:

Technologies: Upgraded to Drupal 7

... FINALLY ...
So I finally did it. Amongst other things, forgetting that I should have copied my list of imagecache presets before embarking on such a journey. Everything seems to be in order so far. I did, unfortunately, break my "Cooliris Portfolio". Hoping to fix shortly.

jQuery get() is Destructive

Drupal Views Variable Height Content Going Horizontal.

I had the disturbing task of creating a 3-column Homepage layout with nodes of varying height. The challenge here is that floating this content with CSS forces the left columns to have huge blocks of whitespace or empty "real estate" as the CSS engine tries to fill space to the right.

Since the desired effect of "most recent content on the top", multiple views or views displays were for the most part out of the question.


Drupal 7 Date Formats and View Modes

Hi! You must have a date formatting issue - You need to display a date within your Drupal 7 site in a more human readable format. I, for instance, needed to display a date in the format of 'September 2012' instead of how the date was stored in the Drupal database: 2012-09-01.


Subscribe to RSS