I noticed that once I had modified the content type to add extra fields and CCK funtionality, the simplenews_template.module was borking on the final rendering of the node.
I've created a patch that simply checks to see if the site is using the CCK module and if so reorganizes the way in which the _simplenews_template_node_view() hook functions.
Instead of directly affecting the $node->content['body']['#value'] field, which in any normal case would append the header and footer, in a case such as using CCK, we cannot directly impact the body, but rather we need to add extra content fields to the $node->content array().
In the case of this patch, I've created to fields:
$node->content['simplenews_header']['#weight'] = -11;
$node->content['simplenews_header']['#value'] = $header;
$node->content['simplenews_header']['#access'] = 1;
$node->content['simplenews_footer']['#weight'] = 11;
$node->content['simplenews_footer']['#value'] = $footer;
$node->content['simplenews_footer']['#access'] = 1;
Please note that the header is weighted at -11 whilst the footer is at 11. This places these fields outside the scope of the weights a user can select within normal CCK UI operations. Thus, sandwiching the content within the header and footer appropriately.
NOTE: It could be added to the settings page to select the weights, but that might be asking too much.
| Comment | File | Size | Author |
|---|---|---|---|
| simplenews_templates_cck.diff | 1.49 KB | wilco |
Comments
Comment #1
tatien commentedI have tried the patch but in my case it plainly removes the header and footer from the message. I tried emptying the cache and got the same result.
Comment #2
tatien commentedOk I figured out the problem. Your patch works: it's just that I was using contemplate and thus needed to add the new fields to the template...
Comment #3
nicholas_w commentedAnother solution that I find gives more flexibility in theming is to simply switch the nodeapi hook from 'view' to 'alter'. I have a patch here.
Comment #4
TBarregren commentedSince this patch tries to accomplish the same thing as tizzo's, while the latter is more general, I mark this as duplicated.