Hi everyone,

I am currently using drupal 6.x and zen theme.

What I am trying to do is hide the attachments table on one or all of my pages.

It looks like the attachments are created using the theme_table() function (line1286) in includes/theme.inc (found by using devel).

Here is the kicker though: I am using the Galleria module to display my images, but I don't want the table to be visible. After looking at the function I'm not sure how I can override it without creating errors in my site, or the entire site coming up blank. Right now I am just on MAMP. Any help or suggestions would be very appreciated!

thanks!

Comments

abdu’s picture

Hai
You can overide the theme function of upload module
Copy the following function code in your template.php(if any) or create a file template.php in your theme folder

function phptemplate_upload_attachments($files) {
  $header = array(t('Attachment'), t('Size'));
  $rows = array();
  foreach ($files as $file) {
    $file = (object)$file;
    if ($file->list && empty($file->remove)) {
      $href = file_create_url($file->filepath);
      $text = $file->description ? $file->description : $file->filename;
      $rows[] = array(l($text, $href), format_size($file->filesize));
    }
  }
  if (count($rows)) {
    //return theme('table', $header, $rows, array('id' => 'attachments'));
  }
  return '';
}

Don't forget to clear the cache in admin/settings/performance

To hide for certain content type write your own conditions

Brydave’s picture

This should work beautifully!!! Thank you!

btw, where is this function coming from or what file will this be overriding? (just out of curiosity...)

Thanks again, I really appreciate your help!!

abdu’s picture

modules/upload/upload.module

chefarov’s picture

For some reason in my case the default function : theme_upload_attachments is not overidden, thus everything remains as it was.

Does anyone know what may be wrong ?

(there was already a template.php file in my theme(=pixture_reloaded) folder. I just entered the above function under the <?php in first lines.

annahelin’s picture

Works perfect! Thanks.

arthur.duarte’s picture

Oh yeah baby!

Worked like a charm in Burnt Rubber theme.

Thank You!