Hello!
I'm using the forward.tpl.php to lay out my forward email (kudos on using the template system to do this!!). However, my CCK data that I'm printing in the template is not being included in the email. I have the three following lines in my forward.tpl.php which are not being sent in the email:

<?php print $node->field_image[0]['view'] ?>
<?php print $node->content['body']['#value'] ?>
<?php print t('View more information about ') . $node['content']->field_evite_ref[0]['view'] ?>

These lines are:

  • A CCK imagefield
  • The body field of the node
  • A reference field on the node

All of these work fine in node templates, but are not being included in the email. Am I correct in assuming that I should be able to put anything that's in the $node into the email, just like theming a node template? Or is there special handling or limitations that I"m not aware of?

As a side note I'm sending the full node (using the UI checkbox) and am using HTML Mail module to ensure html mail sending.

Any help or clarification on this would be appreciated. Thanks!

Comments

Rob_Feature’s picture

I just realized that the $node variable in the forward.tpl.php isn't truly the Drupal $node variable. It doesn't contain the full array. This full array is crucial to be able to do custom email layouts containing all the CCK fields.

Is it possible to somehow load the invite node in this template so I can custom print all the necessary fields? I'd just do my own node_load but I can't even access a $node->nid in this template currently.

Any direction here?

Rob_Feature’s picture

Title: $node contents not sending in email » Add full $node data to forward.tpl.php
Category: bug » feature

I hacked my way to a solution, getting a node load in the template by adding a variable in the .module file that exposes the nid. This is a huge hack on something that I assumed the template should do by default.

So, I'm changing this to a feature request:
It would be great if the $node in the forward.tpl.php was actually the FULL node variable as used in node.tpl.php templates. This would allow us to style our email template and include any custom $node data we want...a huge win for the flexibility of this module.

a6hiji7’s picture

Version: 6.x-1.14 » 6.x-1.9

The node id is there in the URL. So something like $node = node_load(end(explode('/', check_plain($_GET['path'])))) should give you the actual node object.

seanr’s picture

Version: 6.x-1.9 » 6.x-1.x-dev
Status: Active » Fixed

The $node variable is no the full node, and $teaser is what now gets printed in the template. If you've customized the template in your theme, you'll need to update that.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

hillaryneaf’s picture

Does this module show the full node (including CCK fields) or not? I'm confused by what a6hiji7 and seanr have said. They seem to contradict each other. I too need the ability to show the full node in an email with the CCK fields.

john.oltman’s picture

In the D6 version of Forward, the $teaser variable in the default template contains the full content for the node (including CCK fields), as defined by the Display Fields page for the content type, if you "include full node" via the UI. If you are going to print fields directly, you can do the following temporarily to see what fields are available within the loaded node:

<?php print '<pre>'.print_r($node,1).'</pre>'; ?>