Hi,
I need the $node->nid in htmlmail.tpl file in order to redesign the output of the content. However, I do not know how to retrieve it in actual sending to subscribers.
Calling var_dump(get_defined_vars()) gives me these 3 strings:
[String 1]
array(17) { ["template_file"]=> string(39) "sites/all/themes/tendu/htmlmail.tpl.php" ["variables"]=> array(13) { ["template_files"]=> array(0) { } ["body"]=> string(913) "
[String 2]
" ["zebra"]=> string(4) "even" ["id"]=> int(4) ["directory"]=> string(22) "sites/all/themes/tendu" ["is_admin"]=> bool(true)
["is_front"]=> bool(false) ["logged_in"]=> bool(true) ["db_is_active"]=> bool(true) ["user"]=> object(stdClass)#3 (30) { ["uid"]
=> string(1) "1" ["name"]=> string(23) "המנהלן הראשי" ["pass"]=> string(32) "831e33e89ed15fa9f8be5f2ad51150b8" ["mail"]=> string(16) "MYMAIL@gmail.com" ["mode"]=> string(1) "0" ["sort"]=> string(1) "0" ["threshold"]=> string(1) "0" ["theme"]=> string(0) "" ["signature"]=> string(0) "" ["signature_format"]=> string(1) "0" ["created"]=> string(10) "1251712649" ["access"]=> string(10) "1260435136" ["login"]=> string(10) "1259756397" ["status"]=> string(1) "1" ["timezone"]=> NULL ["language"]=> string(2) "he" ["picture"]=> string(42) "sites/default/files/pictures/picture-1.jpg" ["init"]=> string(16) "MYMAIL@gmail.com" ["data"]=> string(148) "a:4:{s:13:"form_build_id";s:37:"form-
03261d0824ca122e1f183ab5ecbfe6d3";s:14:"picture_delete";s:0:"";s:14:"picture_upload";s:0:"";s:7:"contact";i:0;}" ["timezone_name"]=> string(0) "" ["sid"]=> string(32) "7ba1bd7f710f811a1bd578f131c065f1" ["hostname"]=> string(13) "89.139.96.216" ["timestamp"]=> string(10) "1260435148" ["cache"]=> string(1) "0" ["session"]=> string(94) "node_overview_filter|a:0:{}masquerading|N;dblog_overview_filter|a:0:{}updates_remaining|a:0:{}" ["form_build_id"]=> string(37) "form-03261d0824ca122e1f183ab5ecbfe6d3" ["picture_delete"]=> string(0) "" ["picture_upload"]=> string(0) "" ["contact"]=> int(0) ["roles"]=> array(1) { [2]=> string(18) "authenticated user" } } ["header"]=> string(0) "" ["footer"]=> string(0) "" ["css"]=> string(0) "" } ["template_files"]=> array(0) { } ["body"]=> string(931) "
[String 3]
" ["zebra"]=> string(4) "even" ["id"]=> int(4) ["directory"]=> string(22) "sites/all/themes/tendu" ["is_admin"]=> bool(true)
["is_front"]=> bool(false) ["logged_in"]=> bool(true) ["db_is_active"]=> bool(true) ["user"]=> object(stdClass)#3 (30) { ["uid"]
=> string(1) "1" ["name"]=> string(23) "המנהלן הראשי" ["pass"]=> string(32) "831e33e89ed15fa9f8be5f2ad51150b8" ["mail"]=> string(16) "MYMAIL@gmail.com" ["mode"]=> string(1) "0" ["sort"]=> string(1) "0" ["threshold"]=> string(1) "0" ["theme"]=> string(0) "" ["signature"]=> string(0) "" ["signature_format"]=> string(1) "0" ["created"]=> string(10) "1251712649" ["access"]=> string(10) "1260435136" ["login"]=> string(10) "1259756397" ["status"]=> string(1) "1" ["timezone"]=> NULL ["language"]=> string(2) "he" ["picture"]=> string(42) "sites/default/files/pictures/picture-1.jpg" ["init"]=> string(16) "MYMAIL@gmail.com" ["data"]=> string(148) "a:4:{s:13:"form_build_id";s:37:"form-03261d0824ca122e1f183ab5ecbfe6d3";s:14:"picture_delete";s:0:"";s:14:"picture_upload";s:0:"";s:7:"contact";i:0;}" ["timezone_name"]=> string(0) "" ["sid"]=> string(32) "7ba1bd7f710f811a1bd578f131c065f1" ["hostname"]=> string(13) "89.139.96.216" ["timestamp"]=> string(10) "1260435148" ["cache"]=> string(1) "0" ["session"]=> string(94) "node_overview_filter|a:0:{}masquerading|N;dblog_overview_filter|a:0:{}updates_remaining|a:0:{}" ["form_build_id"]=> string(37) "form-03261d0824ca122e1f183ab5ecbfe6d3" ["picture_delete"]=> string(0) "" ["picture_upload"]=> string(0) "" ["contact"]=> int(0) ["roles"]=> array(1) { [2]=> string(18) "authenticated user" } } ["header"]=> string(0) "" ["footer"]=> string(0) "" ["css"]=> string(0) "" ["newsletter_nodeid"]=> string(7) "reports" ["newsletter_node"]=> bool(false) }
-------------
Note: Checking args does not help since in actual sending to subscribers, it is:
arg(0):admin
arg(1):reports
arg(2):status
arg(3):run-cron
Any help will be highly appreciated. Thanks!
Comments
Comment #1
sutharsan commentedChanging module to html mail
Comment #2
amir simantov commentedOK - got it:
Closing issue.
Comment #3
marcushenningsen commentedI'd love to have access to the whole node object in my email, but using your code above doesn't work for me. It actually only outputs 'add', probably because that's the arg(1) on the node/add/simplenews. Can you please explain how you made it work?
Marcus
Comment #4
amir simantov commentedHi Marcus,
I actually abandoned this code because there was a problem using it in simplenews.module when actually sending the newsletter. So, is better to try using the tpl in simplenews for this. I did not get to it yet, though.
Amir
Comment #5
marcushenningsen commentedThanks for your answer. I looked at it again and found a solution, but only in combination with simplenews, which was what I was looking for.
I just copied the simplenews-newsletter-body.tpl.php from the simplenews folder and used the node object directly there. To get images shown in the mail I used this code:
Notice that I have an imagecache preset called simplenews_image which I use in this example.
Now, to get rid of the attached image in the body of the mail, I use the following instead of print $body:
I hope this leads someone in the right direction.