Hello all,
I've searched the forums and I've read the handbooks, I may have missed something but I could find no clear answer in a central place.
Basically, my question is about custom nodes and how to go about building them. Here are some practical examples (they're just examples, I wrote "Gym node", "CD node"... for the sake of clarity only, the idea behind is always "custom node") :
How do I assign a Country field to a Gym node?
- Solution 1: Use a Flexinode with a select (drop-down) field for the country? But then I couldn't re-use the list of countries entered for this flexinode with other flexinodes (or anywhere else in the system).
- Solution 2: Use the CCK (Content Construction Kit)? From what I understood, CCK is like an advanced Flexinode with even more flexibility. I think CCK will allow me to build custom field types (ie. not just custom node types) that I can re-use throughout node types (I may be wrong here). If that's correct, I can build a Country custom field and re-use it in whichever CCK custom node needs it.
- Solution 3: Use the Taxonomy module? Build a Vocabulary called "Countries" containing the list of countries and associate this vocabulary with my flexinode. Then I can re-use the list of countries throughout the system and filter the tagged nodes by country quite easily.
How do I assign an Artist field to a CD node?
- Solution 1: Use Flexinode or CCK with a text field for the artist? It doesn't seem like a good idea (likelihood of typos when typing the artist name, no easy way to retrieve all nodes linked to this artist...). A drop-down field would be better provided I already know the names of all the artists or if I can easily add names to the list. Then I could use the Views module to manipulate the nodes.
- Solution 2: Use the Taxonomy module? Problem: the artist information is not only a way to categorise the CDs. Artists should also have their own custom nodes with their own data (maybe Taxonomy assoc could help here?), and a CD might be linked to several artists.
- Solution 3: Build 2 different custom nodes (CD and Artist) and link them with the Tagnode module? It seems I could also do this with the CCK module which has a nodereference field type.
How do I assign a start date and end date to a Concert node?
- Solution 1: Use CCK or Flexinode?
- Solution 2: Use the Event Module?
Final Comments
Drupal offers many ways to do similar things. It's extremely flexible and that's great, but it leaves me a bit confused at the moment : are the 7 modules mentionned in this post required to do essentially one thing (build custom nodes)?
Conceptually, I'd be tempted to say that CCK+Views is the way to go. I like the idea of having a very flexible toolkit (CCK+Views) and build everything I need with it (that's probably because I'm a programmer and this is a programmer's logic). I'm afraid adding up too many modules to Drupal will end up in a not-so-elegant configuration and will eventually burden the system.
Also, the question is not only how to build custom nodes (and therefore how to organise the data in the system), but also what to do with the custom nodes. Once I have assigned a field (Country, Artist or whatever) to a custom node, I want to be able to filter by that field, order by that field, and display that field's content anywhere when viewing the node. In that respect, the Views module seems great and meets most of my expectation.
A final approach I haven't mentioned would be to build custom modules. While it might be the most effective solution (provided I'm a good programmer :-)), I'm still reluctant to go into Drupal programming right now (I just have a couple weeks of "Drupalling" behind me).
Any help or feeback on this will be greatly appreciated.
Vincent
Comments
Taxonomy
Country field: You may want to look at the Location module for this, as it offers even more functionality you may be interested in (such as having the available countries already filled in, and integration with google maps). If you choose not to do that, I would probably use Taxonomy. Reusability is something important that Drupal offers, and taxonomy simplifies a lot of things like this, once you get used to it.
Artist field: Again, I would probably use the taxonomy. You can allow multiple choices (multiple select) to be selected when you set up your categories.
Also, in 4.7, you may want to look at "free vocabulary" or "free tagging", where you can type new artists ad hoc while creating a node, rather than going into the admin each time. The down side of that would be spelling errors introduced over time, thus having both Ani DiFranco and Ani DeFranco inadvertantly.
Dates: Probably the events module would be the way to go here.
I say all this without much experience with CCK. I"m fairly experienced with flexinode & taxonomy, and use both extensively. Take it with a grain of salt.
- Aaron
Location
Location module is not presently compatible with 4.7.0
It would have offered more functionality as advised.
Apache is bandwidth limited, PHP is CPU limited, and MySQL is memory limited.
Flexinode vs. CCK
I won't speak to most of the points here, but specifically to the question raised in the e-mail to me:
"I'm a bit confused as to which of the 2 to use now. Is CCK a replacement
for Flexinode or will the 2 continue to exist?"
CCK is indeed a replacement, but the two will coexist in Drupal 4.7. I don't feel CCK is quite feature-complete enough that Flexinode can be removed entirely; several custom field types have been developed for Flexinode that aren't available yet for CCK, so the migration path is not seamless. For 4.7 development, you can use either system, but if you're developing a site that will be upgraded past 4.7 then CCK is probably more future-proof.
cck
what great questions. I'm trying to figure this out. watch out that flexinode has a reputation for not scaling due to using an inner join for every field. i don't know if cck scales better in terms of using inner joins.
i also haven't heard that views works with cck.
cck & views
Views work with CCK
See: http://drupal.org/cck-status
Apache is bandwidth limited, PHP is CPU limited, and MySQL is memory limited.
I will follow CCK+Views if
I will follow CCK+Views if this way is more flexible to organise and reuse data in a system.
I have had many similar
I have had many similar queries. And I found my (current) answer in the category module (I'm sure this may change in the future!).
Personally I think the category module should be in the core by default! Basically with this, any node can become a taxonomy term, including custom nodetypes (I use flexinode).
I.e.
- I create an Artist flexinode type
- I create a CD flexinode type
When I create a node of type Artist, I enable it to be a category as well, for CD_NodeTypes and images.
When I create a node of type CD, I can assign it a taxonomy from Artist,
also when I create a node of type Image, I can assign it a taxonomy from Artist.
so far this does what I need it to, however I have not yet tried the CCK module, and its nodereference ability does sound intriguing. I was put off by CCK because the general consensus seemed to be 'its not ready yet, but will be much more powerful in the future'.
But if you havent found the solution you are looking for, and you basically need taxonomy to be their own nodes with customizable properties instead of just a name as it currently is, the category module does that. Then you can use it with flexinodes, and CCK nodes.... (info on CCK+category here: http://category.greenash.net.au/node/158)