Hello, i'm a noob AFA drupal hacking but i'm very interested in learning how the system works better. right now I am trying to get contributions/sandbox/ccourtne/modules/attachment to work with xtemplate.
I followed the instructions according to ccourtne but i'm using xtemplate so the chameleon.patch won't do? things most work just displaying the final links to dowload is a problem. ie. the link for "2 attachments" shows up under the links under the node but when I click it I get a page with only the node table headers; no links to dowload the attachments.
i looked at attachment.module's attachment_list() which is what gets called and it only says
return theme("attachments", $node);
so in xtemplate.theme i have
function xtemplate_attachments($node, $main = 0, $page = 0) {
# $output = "<div class=\"node\">\n";
global $xtemplate;
$header[0]['data'] = 'Filename';
$header[0]['width'] = '100%';
$header[1] = 'Size';
echo "hi node ";
var_dump($node);
$xtemplate->template->assign(array(
"attachcount" => $node->attachcount));
$xtemplate->template->parse("attachments");
$output = $xtemplate->template->text("attachments");
$xtemplate->template->reset("attachments");
return $output;
/**from chameleon.patch
for ($index = 0; $index < $node->attachcount; $index++) {
$attach = array2object($node->attachments[$index]);
$row[$index][0] = l($attach->filename, file_create_url($attach->filepath), array("title" => t("Download attachment")));
$row[$index][1] = $attach->size;
}
$output .= theme('table', $header, $row);
$output .= "</div>\n";
return $output;
**/
}
which i know is a total mess but it's what i'm playing with ATM. the thing that bugs me is when i do
var_dump($node) all i get is bool(true) .. i don't see any data. What happened to the node object? I also tried following this example: http://drupal.org/node/view/5944#12060 and adding a attachment block to xtemplate.xtmpl file, but no luck. I can't get the xtemplate_attachments() to function correctly, i can't see the data. things look correct in the filesystem and the DB.
Does anyone have it working or any incite for this noob. thanks! using DRUPAL-4-4
Comments
it looks like $node really is boolean true.
i also tried print_r($node) and i get 1. i'll have to look for more clues ...
as pointed out by killes and
as pointed out by killes and some other folks i should try using flexinode.