[development] associate dates to nodes

Karen Stevenson karen at elderweb.com
Mon Jul 9 16:00:47 UTC 2007


The Date module won't do this out of the box, but if you know enough about Drupal and PHP to write a custom module I don't think it would be hard to customize it rather than rewrite everything from scratch. You would only need to add a '#validate' item to the form via hook_form_alter(), and have it point to whatever validation function you want to run your dates through. 

That way your customization is only for the validation process and you can use all the built-in data storage, Views integration, and other goodness of CCK pretty much as-is.

If you write a custom module you have to create tables, create forms, create validation routines, create Views integration (if you want an easy way to display all this), etc. etc. Lots more work that way, and you'd have to redo much of it each time you find new info you want to track or whenever the Drupal APIs change.

I don't think anyone has any benchmarks about how far you can scale something like this, but I know we have some very large sites using CCK extensively or exclusively for things like this. 

Karen


----- Original Message ----
From: Alex Moreno <al3xmor3no at gmail.com>
To: development at drupal.org
Sent: Monday, July 9, 2007 10:47:18 AM
Subject: Re: [development] associate dates to nodes

Yes, but when you assign a date to the multiple date field, it should be validated to avoid the same room to be reserved twice. I suppose that this is too complex for the cck module. I´m wrong?

This is why i was thinking in a custom module.



On 7/9/07, Victor Kane <victorkane at gmail.com> wrote:
On 7/9/07, Bèr Kessels <ber at webschuur.com> wrote:

Op maandag 09 juli 2007, schreef Victor Kane:
> The short answer is that you want to create special content types
> (reservation), and then, using the content construction kit module (cck:
> 

http://drupal.org/project/cck) add the appropriate fields, including the
> date field, supported by the date field module (
> 
http://drupal.org/project/date).


This won't work. A "room" will need an arbitrary amount of dates. So you will
need either nodereference, wich won't scale, or some other relational module
(wich won't scale either).




It will work.
You can use the date field as a multiple field, which can certainly give an arbitrary number of dates, or any other fields necessary for reservations.
To go to the trouble of a custom module seems really overkill.

Of course, there is more than one way to do it.





-- 
Alejandro Moreno
<a href="http://www.tdo.es">Consultoría de Publicidad y Marketing Online</a>



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20070709/d575781e/attachment.htm 


More information about the development mailing list