This has to be very simple, I'm sure. But, I'm brain-dead. :-)

I've created a content type for pdf_attachments. I'm using cck filefield for upload. Node reference will be used to attach the pdf to the desired document. I have body turned off in the content type. I have title turned on.

When any staffer attaches a pdf to a document, the text for the link should be consistent. It needs to say "View Adobe PDF."

How I force that consistency?

Thanks!!

POSTSCRIPT: OK, I have used the description field to enable adding the desired text. That seems to work but the question that still remains is how to force it.

Comments

oddible’s picture

Well... not sure why you went with a CCK filefield for this rather than just using native file attachments functionality, but since you did, and since you made your own Content Type for this you can simply do this by editing your theme files. Go to the directory for your theme (probably /sites/themes/yourthemename) and copy node.tpl.php to node-yourcontenttypename.tpl.php and just edit the display to show 'View Adobe PDF' where you want it.

If you had just done this as a regular file attachment rather than a CCK field you could override the upload_attachments function in your template.php and change the filename to whatever you like.


<?php
function phptemplate_upload_attachments($files) {
  $header = array(t('Attachment'), t('Size'));
  $rows = array();
  foreach ($files as $file) {
    if ($file->list) {
      $href = $file->fid ? file_create_url($file->filepath) : url(file_create_filename($file->filename, file_create_path()));
      $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'));
  }
}
?>

WorldFallz’s picture

Maybe she's psychic-- upload is being replaced with filefield in d7 ;-)

Regarding the question-- i would check filefield files and see if there's a theme_ function you can use in your template.php to override the output.

Sunshiney’s picture

Thanks WF.... you're right. I do know about the upload replacement. I also prefer cck filefields because it gives me more control over what non-webby staff folks will be doing in the future. The more control I have, the less pain down the road. Or, at least, I hope.

I'll see what I can do about the theme_function override and give more thought on that node.tpl theme. I haven't used content template module but grabbed it..and wondering if that would do the trick. Have you used it? Looking for more documentation.

WorldFallz’s picture

Yep, contemplate will work also-- it's probably the easiest way.