this is more of a strategy/DRUPAL question to see if anyone has had some success. This same question is posted on the DRUPAL forums:
This is not what the CM module does, but I want to see if anyone has an opinion. I want to create a mail blast from Campaign Monitor. The blast is for a Realestate company of all of their latest listings. So, I would be using a VIEW to generate the List that would be forwarded to CM. The EMail blast has some special graphics.
My QUESTION is where would I do the theming of the EMAIL blast? either in CM or on the DRUPAL site.
I think there are TWO strategies for this:
1... FROM DRUPAL, I would create a view, run it through a .tp.php theming file. This theme would have CM tokens for name, address... blah blah... then it would be submitted to CM for the BLAST.
2... FROM DRUPAL, create ONLY an XML file of the listing data. This would be sent to CM and paired with a CM template and campaign.
is there another way? has anyone tried any of this?
FYI: to those that dont know what VIEWs is... its a DRUPAL feature that allows allows for preset SQL statements, but has some other benefits, like hooks into the menu system, and a configuration screen for creating the VIEW. It also works with something call CCK ( but off topic). VIEWS is the way that DRUPAL pulls data out of the DB. You can also THEME a View. So theoretically, I could pull a Dataset out of VIEWS, pass if through a custom VIEW THEME, and make it look like a CM template. Then I would have to Mail ( or post) the file to CM. But would it not be better to create just a simple DATA file from a view and pass it to a template? anythoughts please
If you go for option (2): how would you 'pair' the generated XML with a CM template? Don't think there's an option to import XML data in a CM campaign.
If you go for option (1): interesting. I think it can be done with the theming engine like you say. I only created Drupal templates for use in ... Drupal :) Not to generate code that can be used in another app like CM. I think you will still manually have to copy the generated html/css (via the .tpl.php) into CM then, or do you see a possibility to automate this?
I just started reading the CM API... but I was initially thinking of going OPTION A... and just passing in a MAIN section. the MAIN section would be enveloped in the CM template. Also, I was thinking that theming the output from DRUPAL is probably over kill... I will study this more tonight and write something more tonight.