views:

611

answers:

2

We're building a module for generating HTML for email newsletters. We've looked into using a few other modules (SimpleNews, MailChimp, among others), but due to various requirements, it'll be easier and better for us to build a custom solution.

Being a new Drupal developer, I'm a bit worried about handling this in a "non-Drupal" way. That being said, my plan is to setup a vocabulary with Newsletters as a term and the actual Newsletters as sub-terms, like so:

Newsletters  (term)
  - Newsletter A (sub-term)
  - Newsletter B (sub-term)

This has the added benefit of being able to organize where articles were published (besides just on the site.)

The question, though, is how to handle the different Newsletter issues. I could go another level deeper in the vocabulary, like so:

Newsletters  (term)
  - Newsletter A (sub-term)
    - Issue - 2010-03-01
    - Issue - 2010-03-02
  - Newsletter B (sub-term)
    - Issue - 2010-03-01
    - Issue - 2010-03-08

But I'm wondering if this is adding a bit too much complexity. Once I have this taxonomy setup, when the user went to add new newsletters it would also create a node (content type: newsletter), and when he/she went to add new issues, it would also create a node (content type: issue.) Those would then be the landing pages for that content.

So, the question is is there a better way for handling this structure? Is this a Drupal-like solution?

+1  A: 

I think you are definitely thinking Drupal-Like, especially since you are thinking of using taxonomy to categorize your newsletters.

I think your "Issue - 2010-03-01" would actually be a node and not a term. (Unless you plan to create multiple article nodes to reference a single "Issue")

Check out the module: http://drupal.org/project/nat (NAT - Node Auto Term) which manages relationships between nodes and taxonomy. With this module, you would simply create a new node for each Newsletter (sub-term). This would automatically create the new term for you. Then you would create a new Issue node in which you would select the "Newsletter" category you wish you publish that newsletter.

You might be able to use signup module (or even flag module) to allow users to register to join your newsletter nodes. (http://drupal.org/project/signup)

xkingpin
A: 

I'm wondering why the users should create a node of type newsletter first when there is a node type for issues? What's the purpose of having a second node type?

Regarding your taxonomy hierarchy you're almost on Drupal's track. I wouldn't create a term called "Newsletters" (I don't see the point, yet), but create a vocabulary called "Newsletters". Within this vocabulary I'd create first-level terms describing the different newsletter available (i.e. "Newsletter A").

Next, you connect the vocabulary "Newsletters" with your content type "issue".

As xkingpin pointed out correctly, NAT (http://drupal.org/project/nat) will be your module of choice, so install it and set up the new options for the content type "issue" (i.e. linkage of issue term).

Then you use your issue node type to create issues (I am assuming all newsletters share the same content type). Upon taxonomy selection you just choose the right newsletter term this issue belongs to (i.e. "Newsletter A"). NAT will automatically assign this term to the issue as well as creating a sub-term to that first-level term. The name of the subterm will match the title of your issue, so you may just call it "Issue #1 - 2010-03-01" to create a sub-term called "Issue #1 - 2010-03-01".

When viewing the issue node it will have two terms assigned ("Newsletter A", "Issue #1 - 2010-03-01"). Any article referenced within the issue may now be tagged with the issue sub-term. On NAT admin ui you may choose if the issue term directly links to the issue node instead of linking to a view of all node tagged with the same issue term (which is default behaviour of drupal).

Paul