[support] this code wrecks my site

Marty Landman mlandman at face2interface.com
Mon Jan 9 16:01:40 UTC 2012


I've set up a content type containing a single additional field, an 
existing field called field_associated_node which is a node 
reference. In my content type this associated node field may repeat 
an arbitrary number of times. Then I use the code below to get all 
these nodes and display them from an image cache file path.

   <?php
     $image = '<div class="image-gallery--image-link"><a 
href="/files/imagecache/lesson_image-fullsize/pictures/%s" ' .
              'rel="lightbox[wall]"><img 
src="/files/imagecache/lesson_image-centercolumn/pictures/%s" /></a></div>';
     foreach ($node->field_associated_node as $associated) {
       $assoc_node = node_load($associated[nid]);
       $file_path = $assoc_node->field_image_file_path[0]['value'];
       $bfr = sprintf($image, $file_path, $file_path);
       print $bfr;
     }
   ?>

This works on my staging site, but on the live site as soon as I 
create one of these content type nodes the site's theme breaks. 
Restoring the database fixes it. I am wondering if my retrieval loop 
above is the problem, or where to look.

This is a 6.22 site and the live site is in better shape than staging 
- other than this particular problem. Our plan was to wrap up a 
little more development and then migrate live down to staging for 
some maintenance; then this came up. :-(

Marty



More information about the support mailing list