By default, any styling we try to perform on the download nodes will affect all other nodes as well. This probably isn't what we had in mind, so let's correct that.
Note: In this tutorial, I am using the standard Garland theme, but the process should be the same for others.
First we need tell the template engine to look for the right file when it is rendering the nodes. Inside of your template directory, open the "template.php" file. Look for the phptemplate_preprocess_page function (around line 55) and change the entire function body from
function phptemplate_preprocess_page(&$vars) {
$vars['tabs2'] = menu_secondary_local_tasks();
// Hook into color.module
if (module_exists('color')) {
_color_page_alter($vars);
}
}
to
function phptemplate_preprocess_page(&$variables) {
if ($node = menu_get_object()) {
$variables['node'] = $node;
$suggestions = array();
$template_filename = 'page';
$template_filename = $template_filename . '-' . $variables['node']->type;
$suggestions[] = $template_filename;
$variables['template_files'] = $suggestions;
}
}
(actually, I just comment out the old function. You know, in case something goes wrong.)
Save and close "template.php."
I'm not actually sure this is necessary. If the attached file is not displaying in the node, add the following code to the end of node.tpl.php (just before the last </div> tag.)
<?php if ($page == 0) { // dont list them in full node view
if ($node->links['upload_attachments']['title']){ // anyone know a cleaner way of checking wether there are files uploaded AND listable?
print ("<B>".$node->links['upload_attachments']['title'].":</B>"); // Printing how many there are (this is what gets printed out in your "links" <div>)
print("<UL>");
foreach($node->files as $file){
if ($file->list == 1){ // check wether the files are listable in each case so that we don't print "unlistable" files
print ("<LI><A HREF=\"".$file->filepath."\">".$file->description."</A>"); //Printing the description of each file linking to it
}
}
print ("</UL>");
}
}
?>