By optalgin on
I am porting a web application into drupal
In my application's scheme I have events, participants and items
[event] <-- [item] --> [participant]
event: eid, date, location ...
participant: pid, name, status ... (drupal uid to connect a player with user)
item: eid, pid, data...
in my add event page I have a form; something like
date: [....]
location: [....]
participant 1: [....]
participant 2: [....]
participant 3: [....]
...
* view page is similar
In the current implementation I have a table for each with minimal data store in database
I'm looking for the best way to port this model into drupal and thinking about
creating content types and using using CCK.
I have developed some drupal modules before but never had to go deep into CCK and views
and will appreciate your experience
- Is this the right way or am I just making things complicated without reason?
- Can I consider participant a content?
- Non have titles.. the body can be used for participant details maybe?
- Will it store much more data in the database ? (memory/space/performance)
- Will it give me better flexibility to extend the content in the future
- Do I have to do it if I want to use the power of views?
I hope this is not a dumb question.. consider me as a CCK & views newbie :-)
(with motivation to explore and learn)
Comments
Definitely CCK
A great advantage of drupal is how it handles content.
Therefore, CCK is, in my opinion, one of it's strongest modules.
If I were you, I would make content types of "item" and "event".
The participants should be users, and I learned today that instead of adding fields to the core Profile module, you can use the Bio module: http://drupal.org/project/bio , which makes the profile a node (haven't played with it too much, but seems promising).
There is also an option of making fields in your content type node references to other content types, such as what you wrote about an event having many participants (if your participants are nodes).
For more CCK fields and related modules go to: http://drupal.org/project/Modules/category/88 .
Good luck,
Noa Giladi
Sergata Ltd.
I've been thinking...
Thank you noa,
I've done some reading and thinking and I understand that CCK is a great way to create content types using drupal's GUI. *Please correct me if I've wrong*
I am about to code this into a shared module and I was wondering, wouldn't it be easier to site admins that all content types are already defined inside the module programatically... in that case do I still need CCK?!?
regarding the design, event shall defently be a node, as users will be able to view/add/edit.
items shall be added from the event add/edit page (see form example above, much easier instead of adding one by one). There is no item add/update/view to users at all, In that case do you still think items shall be nodes?
I think participants shall not be nodes, and participant management shall be in the admin area
they cannot be users because not all users are paticipants and vice versa but they should have a relation field (uid).
Thanks for your help
And lets hope peace will come soon to our area :-|
I didn't quite understand...
I didn't quite understand why you are trying to make a new module that will create the event node...
In CCK all you have to do is create the fields of your content type once through the "admin" panel, and then users can create content very easily.
And if for example you want an "item" to be created when an "event" is created (if i understood correctly), then you can use workflow-ng, which is another excellent module (it exists in drupal 5 and there is something similar for drupal 6). There you can make an "item" content type when an "event" content type is created.
About the participants and users, I now understand they are not the same, but using the Bio module might still be a good way of dealing with them - read about it a bit and see.
I hope this helps,
Noa Giladi
Sergata Ltd.
I want this 'functionality' to run on many sites
My design is generic, I want this 'functionality' to run on many sites and not only on my own site. I don't want the users of my module to create anything manually.. And that is why I want to create a module instead of using 'admin' pages
I agree it's easier to create content types and CCK instead of writing code and it is a better way for a single site.
Thanks a lot, you helped me understand the different methods
Hope to publish my module soon :-)
optalgin (nir)
Enlightenment
After lots or reading and quite a few hands-on I think I begin to feel the power of CCK & Views.
My main problem now is items..
Event is node-type and participants shall be managed within a module
but what about items? how do I create them..
I shall have 1 item for each participant in a known event..
The workflow-ng you recommended is not available for drupal 6.x :-(
Example relation of events, participants and items
A,B,C.. are items... p1, p2.. participants..
This have impact on my overall design, but since it is a hobby and my major goal is to master drupal. I can afford a redesign :-) The thing is that I come from a point of view of a developer and my first choice is to code. But I don't want to lose the power of CCK & views so I need to decide what shall be done using existing drupal modules (views & cck etc..) and what to code..
One more question:
Lets say I build my content using custom content types and CCK
I build my views and done some other processing and goodies using custom modules
Then I want to share this code/project and create a package to share/publish on drupal site..
Is "installation profiles" the only way to share content types based on CCK?
Or can it be done in the module's installation stage (I've never seen this in a module)
B.T.W
Recommended reading and hands-on "Using Drupal" Sample Chapter
For the "item"s I still
For the "item"s I still recommend using a content type. You have an option of making a "node reference" field that will hold the id of the event and another field that will hold the id of the participant and the rest of the fields you need as you need them.
About working with "workflow-ng" in 6, check out the "rules module": http://drupal.org/project/rules .
I haven't had a chance to work with it, but it seems it has all the power that "workflow-ng" has.
Regarding your question about the installations, I didn't understand what exactly you want to do...
But there are ways to ad functions to a module that change it's installation behavior, if that is what you are after.
Thank you for the link,
Noa Giladi
Sergata Ltd.