Get content to appear on specific page, based on user input in CCK

Events happening in the community are now at Drupal community events on www.drupal.org.
kscott22's picture

I've got a site with the content type "event." I'd like users to be able to create a poll specific to a single "event" page. I'd like the poll to appear on the related "event" page and only that page. (So Poll A only appears at the bottom of the Event A page; Poll B only appears at the bottom of the Event B page; etc.)

Using CCK, I can have the user enter the URL of the event page when creating the poll. But how can I tell Drupal to post that poll on the bottom of that URL?

I'm sure this is possible -- I just can't seem to wrap my mind around it. Any suggestions or ideas would be very helpful! Thanks!

Comments

Panels can do that

gthoele's picture

Hi,

i've done a similar thing for a site for a political party: It has nodes of type "event" for events, and each event can be associated with one or more topics which are nodes of type "topic".
This functionality can be created using a combination of various modules. What I did is:

  • Create the content types. In the "topic" type include a nodereference field. Set allowed values to "event" nodes. This needs CCK. This is what creates the machine-readable link between events and topics.
  • Use the Views module to create a view which lists all topics which have a nodereference field for a specific event. Set the nodereference field as argument, so that one can choose to display all topics for any event by putting the node id of the event into the URL. Install panels and ctools first so that you can save the view as a view content pane.
  • Use the panels and ctools modules to override the display of "event" nodes. Configure the panel so that it displays the event node first and add the views content pane which lists the topics, setting the event node id as argument.

One problem is still unsolved: When creating a topic users still have to go to "Create Content -> Topic" and select an event from a potentially huge list of events which their topic should belong to. A solution for me was the prepopulate module - it allows to create links on events pages which link to a "Create Topic" page with the nodereference already selected accordingly.

I know it is a very complicated and roundabout way but it actually works well. See it in Action here:
https://www.piratenpartei-hamburg.de/termin/2010-08-10/piratentreffen
(in german language...)

Hope this helps, Gunnar

Thanks, Gunnar

kscott22's picture

I'll try this out and see how it goes. I really appreciate the quick reply!!!

Here's how I would approach

caschbre's picture

Here's how I would approach it...

Use CCK node reference to tie a poll to an event. You can even use the node reference URL widget to make it super easy to create the poll while viewing the event page so the user doesn't have to type anything in. Then use the views_attach module to create a view that displays the poll. Have that view take the event nid as an argument. The views_attach module will then display that view automatically on the event node page.

Since this is in the rules group... just an FYI that no rules are necessary.

Node reference

kscott22's picture

Thanks! It appears that both of you are suggesting similar paths. I'm still a bit of a noob -- I haven't used Views arguments extensively and I've never used node reference before. I think the answer is there, but I'm still struggling due to my lack of experience.

I'm looking up tutorials on both arguments and node reference to help me out a bit -- if you have any suggestions of where I can go to educate myself, I'd be very appreciative.

Thanks again! I think you both have set me on the right path.

Node Reference (part of CCK)

caschbre's picture

edit: moved the discussion over to http://drupal.org/comment/reply/881792

Rules

Group organizers

Group categories

Categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: